mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-22 11:34:57 -05:00
Simplify code
This commit is contained in:
parent
bed7889703
commit
9da4c5340d
@ -93,7 +93,7 @@ class BaseHandler(object):
|
|||||||
membership_event = state.get((EventTypes.Member, user_id), None)
|
membership_event = state.get((EventTypes.Member, user_id), None)
|
||||||
if membership_event:
|
if membership_event:
|
||||||
was_forgotten_at_event = yield self.store.was_forgotten_at(
|
was_forgotten_at_event = yield self.store.was_forgotten_at(
|
||||||
membership_event.user_id,
|
membership_event.state_key,
|
||||||
membership_event.room_id,
|
membership_event.room_id,
|
||||||
membership_event.event_id
|
membership_event.event_id
|
||||||
)
|
)
|
||||||
|
@ -295,7 +295,7 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
sql = (
|
sql = (
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" COUNT(*)"
|
" COUNT(*)"
|
||||||
"FROM"
|
" FROM"
|
||||||
" room_memberships"
|
" room_memberships"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" user_id = ?"
|
" user_id = ?"
|
||||||
@ -318,8 +318,8 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
def f(txn):
|
def f(txn):
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" COUNT(*)"
|
" forgotten"
|
||||||
"FROM"
|
" FROM"
|
||||||
" room_memberships"
|
" room_memberships"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" user_id = ?"
|
" user_id = ?"
|
||||||
@ -327,11 +327,9 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
" room_id = ?"
|
" room_id = ?"
|
||||||
" AND"
|
" AND"
|
||||||
" event_id = ?"
|
" event_id = ?"
|
||||||
" AND"
|
|
||||||
" forgotten = 1"
|
|
||||||
)
|
)
|
||||||
txn.execute(sql, (user_id, room_id, event_id))
|
txn.execute(sql, (user_id, room_id, event_id))
|
||||||
rows = txn.fetchall()
|
rows = txn.fetchall()
|
||||||
return rows[0][0]
|
return rows[0][0]
|
||||||
count = yield self.runInteraction("did_forget_membership_at", f)
|
forgot = yield self.runInteraction("did_forget_membership_at", f)
|
||||||
defer.returnValue(count == 1)
|
defer.returnValue(forgot == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user