Delete old, unused methods and rename new one to just be user_delete_access_tokens with an except_token_ids argument doing what it says on the tin.

This commit is contained in:
David Baker 2016-03-11 14:29:01 +00:00
parent 57c444b3ad
commit f523177850
2 changed files with 3 additions and 16 deletions

View File

@ -438,7 +438,7 @@ class AuthHandler(BaseHandler):
except_access_token_ids = [requester.access_token_id] if requester else [] except_access_token_ids = [requester.access_token_id] if requester else []
yield self.store.user_set_password_hash(user_id, password_hash) yield self.store.user_set_password_hash(user_id, password_hash)
yield self.store.user_delete_access_tokens_except( yield self.store.user_delete_access_tokens(
user_id, except_access_token_ids user_id, except_access_token_ids
) )
yield self.hs.get_pusherpool().remove_pushers_by_user_except_access_tokens( yield self.hs.get_pusherpool().remove_pushers_by_user_except_access_tokens(

View File

@ -195,20 +195,7 @@ class RegistrationStore(SQLBaseStore):
}) })
@defer.inlineCallbacks @defer.inlineCallbacks
def user_delete_access_tokens(self, user_id): def user_delete_access_tokens(self, user_id, except_token_ids):
yield self.runInteraction(
"user_delete_access_tokens",
self._user_delete_access_tokens, user_id
)
def _user_delete_access_tokens(self, txn, user_id):
txn.execute(
"DELETE FROM access_tokens WHERE user_id = ?",
(user_id, )
)
@defer.inlineCallbacks
def user_delete_access_tokens_except(self, user_id, except_token_ids):
def f(txn): def f(txn):
txn.execute( txn.execute(
"SELECT id, token FROM access_tokens WHERE user_id = ? LIMIT 50", "SELECT id, token FROM access_tokens WHERE user_id = ? LIMIT 50",
@ -226,7 +213,7 @@ class RegistrationStore(SQLBaseStore):
), [r[0] for r in rows] ), [r[0] for r in rows]
) )
return len(rows) == 50 return len(rows) == 50
while (yield self.runInteraction("user_delete_access_tokens_except", f)): while (yield self.runInteraction("user_delete_access_tokens", f)):
pass pass
@cached() @cached()