-
-
Notifications
You must be signed in to change notification settings - Fork 278
Showing Bot Markers. #1187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Showing Bot Markers. #1187
Changes from all commits
0ed43fa
b1e3ea6
1e036de
c0a29a7
34ac885
c73c5df
7004c87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1018,25 +1018,25 @@ def user_dict(logged_on_user: Dict[str, Any]) -> Dict[str, Dict[str, Any]]: | |
"[email protected]": { | ||
"email": "[email protected]", | ||
"full_name": "Email Gateway", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 6, | ||
}, | ||
"[email protected]": { | ||
"email": "[email protected]", | ||
"full_name": "Zulip Feedback Bot", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 1, | ||
}, | ||
"[email protected]": { | ||
"email": "[email protected]", | ||
"full_name": "Notification Bot", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 5, | ||
}, | ||
"[email protected]": { | ||
"email": "[email protected]", | ||
"full_name": "Welcome Bot", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 4, | ||
}, | ||
} | ||
|
@@ -1075,7 +1075,7 @@ def user_list(logged_on_user: Dict[str, Any]) -> List[Dict[str, Any]]: | |
{ | ||
"email": "[email protected]", | ||
"full_name": "Email Gateway", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 6, | ||
}, | ||
{ | ||
|
@@ -1105,19 +1105,19 @@ def user_list(logged_on_user: Dict[str, Any]) -> List[Dict[str, Any]]: | |
{ | ||
"email": "[email protected]", | ||
"full_name": "Notification Bot", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 5, | ||
}, | ||
{ | ||
"email": "[email protected]", | ||
"full_name": "Welcome Bot", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 4, | ||
}, | ||
{ | ||
"email": "[email protected]", | ||
"full_name": "Zulip Feedback Bot", | ||
"status": "inactive", | ||
"status": "bot", | ||
"user_id": 1, | ||
}, | ||
] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -975,6 +975,15 @@ def get_all_users(self) -> List[Dict[str, Any]]: | |
"user_id": user["user_id"], | ||
"status": status, | ||
} | ||
|
||
if user["is_bot"]: | ||
self.user_dict[user["email"]] = { | ||
"full_name": user["full_name"], | ||
"email": email, | ||
"user_id": user["user_id"], | ||
"status": "bot", | ||
} | ||
Comment on lines
+979
to
+985
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bots don't have status - hence the marker - so let's avoid doing the work just above this and treat a bot specially, like with the user running the application, in a block further up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you understand my suggestion? You've not replied or updated for it. |
||
|
||
self._all_users_by_id[user["user_id"]] = user | ||
self.user_id_email_dict[user["user_id"]] = email | ||
|
||
|
@@ -985,7 +994,7 @@ def get_all_users(self) -> List[Dict[str, Any]]: | |
"full_name": bot["full_name"], | ||
"email": email, | ||
"user_id": bot["user_id"], | ||
"status": "inactive", | ||
"status": "bot", | ||
} | ||
self._cross_realm_bots_by_id[bot["user_id"]] = bot | ||
self._all_users_by_id[bot["user_id"]] = bot | ||
|
@@ -1012,12 +1021,18 @@ def get_all_users(self) -> List[Dict[str, Any]]: | |
for properties in self.user_dict.values() | ||
if properties["status"] == "inactive" | ||
] | ||
bot = [ | ||
properties | ||
for properties in self.user_dict.values() | ||
if properties["status"] == "bot" | ||
] | ||
Comment on lines
+1024
to
+1028
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is different behavior than what you had before, and what we have now, so it at least warrants mentioning what changed in the commit text. I'd almost suggest this could be a separate commit, since it's a different change - the ordering, not the icon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rebased anda added a new commit. |
||
|
||
# Construct user_list from sorted components of each list | ||
user_list = sorted(active, key=lambda u: u["full_name"].casefold()) | ||
user_list += sorted(idle, key=lambda u: u["full_name"].casefold()) | ||
user_list += sorted(offline, key=lambda u: u["full_name"].casefold()) | ||
user_list += sorted(inactive, key=lambda u: u["full_name"].casefold()) | ||
user_list += sorted(bot, key=lambda u: u["full_name"].casefold()) | ||
# Add current user to the top of the list | ||
user_list.insert(0, current_user) | ||
self.user_dict[current_user["email"]] = current_user | ||
|
Uh oh!
There was an error while loading. Please reload this page.