mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Docs
This commit is contained in:
parent
5cb298c934
commit
56dbcd1524
@ -751,6 +751,19 @@ class RoomListHandler(BaseHandler):
|
||||
class RoomContextHandler(BaseHandler):
|
||||
@defer.inlineCallbacks
|
||||
def get_event_context(self, user, room_id, event_id, limit):
|
||||
"""Retrieves events, pagination tokens and state around a given event
|
||||
in a room.
|
||||
|
||||
Args:
|
||||
user (UserID)
|
||||
room_id (str)
|
||||
event_id (str)
|
||||
limit (int): The maximum number of events to return in total
|
||||
(excluding state).
|
||||
|
||||
Returns:
|
||||
dict
|
||||
"""
|
||||
before_limit = math.floor(limit/2.)
|
||||
after_limit = limit - before_limit
|
||||
|
||||
|
@ -439,6 +439,19 @@ class StreamStore(SQLBaseStore):
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_events_around(self, room_id, event_id, before_limit, after_limit):
|
||||
"""Retrieve events and pagination tokens around a given event in a
|
||||
room.
|
||||
|
||||
Args:
|
||||
room_id (str)
|
||||
event_id (str)
|
||||
before_limit (int)
|
||||
after_limit (int)
|
||||
|
||||
Returns:
|
||||
dict
|
||||
"""
|
||||
|
||||
results = yield self.runInteraction(
|
||||
"get_events_around", self._get_events_around_txn,
|
||||
room_id, event_id, before_limit, after_limit
|
||||
@ -462,6 +475,19 @@ class StreamStore(SQLBaseStore):
|
||||
})
|
||||
|
||||
def _get_events_around_txn(self, txn, room_id, event_id, before_limit, after_limit):
|
||||
"""Retrieves event_ids and pagination tokens around a given event in a
|
||||
room.
|
||||
|
||||
Args:
|
||||
room_id (str)
|
||||
event_id (str)
|
||||
before_limit (int)
|
||||
after_limit (int)
|
||||
|
||||
Returns:
|
||||
dict
|
||||
"""
|
||||
|
||||
results = self._simple_select_one_txn(
|
||||
txn,
|
||||
"events",
|
||||
|
Loading…
Reference in New Issue
Block a user