Skip to content

Commit

Permalink
Update state store after sending state event (ref mautrix/telegram#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jun 20, 2019
1 parent f6064bc commit 6b38cec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mautrix_appservice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
from .state_store import StateStore
from .intent_api import IntentAPI

__version__ = "0.3.10.dev1"
__version__ = "0.3.11"
__author__ = "Tulir Asokan <[email protected]>"
9 changes: 8 additions & 1 deletion mautrix_appservice/intent_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,14 @@ async def send_state_event(self, room_id: str, event_type: str, content: dict,
has_pl = await self._ensure_has_power_level_for(room_id, event_type, is_state_event=True)
if has_pl:
url = self._get_state_url(room_id, event_type, state_key)
return await self.client.request("PUT", url, content, **kwargs)
resp = await self.client.request("PUT", url, content, **kwargs)
self.state_store.update_state({
"type": event_type,
"room_id": room_id,
"state_key": state_key,
"content": content,
})
return resp

async def get_state_event(self, room_id: str, event_type: str, state_key: Optional[str] = ""
) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="mautrix-appservice",
version="0.3.10.dev1",
version="0.3.11",
url="https://github.com/tulir/mautrix-appservice-python",

author="Tulir Asokan",
Expand Down

0 comments on commit 6b38cec

Please sign in to comment.