Skip to content

Commit

Permalink
Don't let failure to get chat user's username prevent sending report
Browse files Browse the repository at this point in the history
-autopull
  • Loading branch information
makyen committed Dec 2, 2021
1 parent aeea386 commit f89196d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions datahandling.py
Expand Up @@ -544,11 +544,18 @@ def get_user_ids_on_notification_list(chat_site, room_id, se_site):
def get_user_names_on_notification_list(chat_site, room_id, se_site, client):
names = []
non_always_ids = []
for i, always in get_user_ids_on_notification_list(chat_site, room_id, se_site):
for user_id, always in get_user_ids_on_notification_list(chat_site, room_id, se_site):
if always:
names.append(client.get_user(i).name)
try:
names.append(client.get_user(user_id).name)
except Exception:
# The user is probably deleted, or we're having communication problems with chat.
log_exception(*sys.exc_info())
log('warn', 'ChatExchange failed to get user for a report notification. '
'See Error log for more details. Tried client.host: '
'{}:: user_id: {}:: chat_site: {}'.format(client.host, user_id, chat_site))
else:
non_always_ids.append(i)
non_always_ids.append(user_id)

if non_always_ids:
# If there are no users who have requested to be pinged only when present in the room, then we
Expand Down

0 comments on commit f89196d

Please sign in to comment.