mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Remove unused code path from member change DB func
The function is never called without a from_key, so we can remove all the handling for that scenario.
This commit is contained in:
parent
05e0a2462c
commit
c0e08dc45b
@ -304,10 +304,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_membership_changes_for_user(self, user_id, from_key, to_key):
|
def get_membership_changes_for_user(self, user_id, from_key, to_key):
|
||||||
if from_key is not None:
|
from_id = RoomStreamToken.parse_stream_token(from_key).stream
|
||||||
from_id = RoomStreamToken.parse_stream_token(from_key).stream
|
|
||||||
else:
|
|
||||||
from_id = None
|
|
||||||
to_id = RoomStreamToken.parse_stream_token(to_key).stream
|
to_id = RoomStreamToken.parse_stream_token(to_key).stream
|
||||||
|
|
||||||
if from_key == to_key:
|
if from_key == to_key:
|
||||||
@ -321,26 +318,15 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||||||
defer.returnValue([])
|
defer.returnValue([])
|
||||||
|
|
||||||
def f(txn):
|
def f(txn):
|
||||||
if from_id is not None:
|
sql = (
|
||||||
sql = (
|
"SELECT m.event_id, stream_ordering FROM events AS e,"
|
||||||
"SELECT m.event_id, stream_ordering FROM events AS e,"
|
" room_memberships AS m"
|
||||||
" room_memberships AS m"
|
" WHERE e.event_id = m.event_id"
|
||||||
" WHERE e.event_id = m.event_id"
|
" AND m.user_id = ?"
|
||||||
" AND m.user_id = ?"
|
" AND e.stream_ordering > ? AND e.stream_ordering <= ?"
|
||||||
" AND e.stream_ordering > ? AND e.stream_ordering <= ?"
|
" ORDER BY e.stream_ordering ASC"
|
||||||
" ORDER BY e.stream_ordering ASC"
|
)
|
||||||
)
|
txn.execute(sql, (user_id, from_id, to_id,))
|
||||||
txn.execute(sql, (user_id, from_id, to_id,))
|
|
||||||
else:
|
|
||||||
sql = (
|
|
||||||
"SELECT m.event_id, stream_ordering FROM events AS e,"
|
|
||||||
" room_memberships AS m"
|
|
||||||
" WHERE e.event_id = m.event_id"
|
|
||||||
" AND m.user_id = ?"
|
|
||||||
" AND stream_ordering <= ?"
|
|
||||||
" ORDER BY stream_ordering ASC"
|
|
||||||
)
|
|
||||||
txn.execute(sql, (user_id, to_id,))
|
|
||||||
|
|
||||||
rows = [_EventDictReturn(row[0], None, row[1]) for row in txn]
|
rows = [_EventDictReturn(row[0], None, row[1]) for row in txn]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user