mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-25 11:39:21 -05:00
fix pep8 and tests
This commit is contained in:
parent
1bd40ca73e
commit
74e0cc74ce
@ -194,7 +194,7 @@ class ProfileHandler(BaseHandler):
|
|||||||
if self.hs.config.user_directory_search_all_users:
|
if self.hs.config.user_directory_search_all_users:
|
||||||
profile = yield self.store.get_profileinfo(target_user.localpart)
|
profile = yield self.store.get_profileinfo(target_user.localpart)
|
||||||
yield self.user_directory_handler.handle_local_profile_change(
|
yield self.user_directory_handler.handle_local_profile_change(
|
||||||
target_user.user_id, profile
|
target_user.to_string(), profile
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self._update_join_states(requester, target_user)
|
yield self._update_join_states(requester, target_user)
|
||||||
|
@ -162,7 +162,7 @@ class UserDirectoryHandler(object):
|
|||||||
num_processed_rooms = 0
|
num_processed_rooms = 0
|
||||||
|
|
||||||
for room_id in room_ids:
|
for room_id in room_ids:
|
||||||
logger.info("Handling room %d/%d", num_processed_rooms+1, len(room_ids))
|
logger.info("Handling room %d/%d", num_processed_rooms + 1, len(room_ids))
|
||||||
yield self._handle_initial_room(room_id)
|
yield self._handle_initial_room(room_id)
|
||||||
num_processed_rooms += 1
|
num_processed_rooms += 1
|
||||||
yield sleep(self.INITIAL_SLEEP_MS / 1000.)
|
yield sleep(self.INITIAL_SLEEP_MS / 1000.)
|
||||||
@ -176,7 +176,7 @@ class UserDirectoryHandler(object):
|
|||||||
for user_id in user_ids:
|
for user_id in user_ids:
|
||||||
# We add profiles for all users even if they don't match the
|
# We add profiles for all users even if they don't match the
|
||||||
# include pattern, just in case we want to change it in future
|
# include pattern, just in case we want to change it in future
|
||||||
logger.info("Handling user %d/%d", num_processed_users+1, len(user_ids))
|
logger.info("Handling user %d/%d", num_processed_users + 1, len(user_ids))
|
||||||
yield self._handle_local_user(user_id)
|
yield self._handle_local_user(user_id)
|
||||||
num_processed_users += 1
|
num_processed_users += 1
|
||||||
yield sleep(self.INITIAL_SLEEP_MS / 1000.)
|
yield sleep(self.INITIAL_SLEEP_MS / 1000.)
|
||||||
@ -423,7 +423,6 @@ class UserDirectoryHandler(object):
|
|||||||
if not row:
|
if not row:
|
||||||
yield self.store.add_profiles_to_user_dir(None, {user_id: profile})
|
yield self.store.add_profiles_to_user_dir(None, {user_id: profile})
|
||||||
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _handle_new_user(self, room_id, user_id, profile):
|
def _handle_new_user(self, room_id, user_id, profile):
|
||||||
"""Called when we might need to add user to directory
|
"""Called when we might need to add user to directory
|
||||||
|
@ -640,10 +640,9 @@ class UserDirectoryStore(SQLBaseStore):
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
if self.hs.config.user_directory_search_all_users:
|
if self.hs.config.user_directory_search_all_users:
|
||||||
join_clause = ""
|
join_clause = ""
|
||||||
where_clause = "?<>''" # naughty hack to keep the same number of binds
|
where_clause = "?<>''" # naughty hack to keep the same number of binds
|
||||||
else:
|
else:
|
||||||
join_clause = """
|
join_clause = """
|
||||||
LEFT JOIN users_in_public_rooms AS p USING (user_id)
|
LEFT JOIN users_in_public_rooms AS p USING (user_id)
|
||||||
@ -692,7 +691,7 @@ class UserDirectoryStore(SQLBaseStore):
|
|||||||
display_name IS NULL,
|
display_name IS NULL,
|
||||||
avatar_url IS NULL
|
avatar_url IS NULL
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
""" % ( join_clause, where_clause )
|
""" % (join_clause, where_clause)
|
||||||
args = (user_id, full_query, exact_query, prefix_query, limit + 1,)
|
args = (user_id, full_query, exact_query, prefix_query, limit + 1,)
|
||||||
elif isinstance(self.database_engine, Sqlite3Engine):
|
elif isinstance(self.database_engine, Sqlite3Engine):
|
||||||
search_query = _parse_query_sqlite(search_term)
|
search_query = _parse_query_sqlite(search_term)
|
||||||
@ -710,7 +709,7 @@ class UserDirectoryStore(SQLBaseStore):
|
|||||||
display_name IS NULL,
|
display_name IS NULL,
|
||||||
avatar_url IS NULL
|
avatar_url IS NULL
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
""" % ( join_clause, where_clause )
|
""" % (join_clause, where_clause)
|
||||||
args = (user_id, search_query, limit + 1)
|
args = (user_id, search_query, limit + 1)
|
||||||
else:
|
else:
|
||||||
# This should be unreachable.
|
# This should be unreachable.
|
||||||
|
Loading…
Reference in New Issue
Block a user