diff options
author | Erik Johnston <erik@matrix.org> | 2014-09-06 02:23:36 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-09-06 02:23:36 +0100 |
commit | 781ff713ba65e9a8075063ee5112479afcb412ed (patch) | |
tree | 1df45adf38713cac9d045c43296f1026897c91c6 /synapse/storage/__init__.py | |
parent | Document new invite key added to createRoom api (diff) | |
download | synapse-781ff713ba65e9a8075063ee5112479afcb412ed.tar.xz |
When getting a state event also include the previous content
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r-- | synapse/storage/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index d97014f4da..81c3c94b2e 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -81,7 +81,7 @@ class DataStore(RoomMemberStore, RoomStore, defer.returnValue(latest) @defer.inlineCallbacks - def get_event(self, event_id): + def get_event(self, event_id, allow_none=False): events_dict = yield self._simple_select_one( "events", {"event_id": event_id}, @@ -92,8 +92,12 @@ class DataStore(RoomMemberStore, RoomStore, "content", "unrecognized_keys" ], + allow_none=allow_none, ) + if not events_dict: + defer.returnValue(None) + event = self._parse_event_from_row(events_dict) defer.returnValue(event) @@ -220,7 +224,8 @@ class DataStore(RoomMemberStore, RoomStore, results = yield self._execute_and_decode(sql, *args) - defer.returnValue([self._parse_event_from_row(r) for r in results]) + events = yield self._parse_events(results) + defer.returnValue(events) @defer.inlineCallbacks def _get_min_token(self): |