Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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,
},
{
Expand Down Expand Up @@ -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,
},
]
Expand Down
1 change: 1 addition & 0 deletions zulipterminal/config/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
STATUS_IDLE = "◒"
STATUS_OFFLINE = "○"
STATUS_INACTIVE = "•"
BOT_MARKER = "♟"
AUTOHIDE_TAB_LEFT_ARROW = "❰"
AUTOHIDE_TAB_RIGHT_ARROW = "❱"
1 change: 1 addition & 0 deletions zulipterminal/config/themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
'user_idle' : '',
'user_offline' : '',
'user_inactive' : '',
'user_bot' : '',
'title' : 'bold',
'column_title' : 'bold',
'time' : '',
Expand Down
2 changes: 2 additions & 0 deletions zulipterminal/config/ui_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from zulipterminal.api_types import EditPropagateMode
from zulipterminal.config.symbols import (
BOT_MARKER,
STATUS_ACTIVE,
STATUS_IDLE,
STATUS_INACTIVE,
Expand All @@ -27,6 +28,7 @@
"idle": STATUS_IDLE,
"offline": STATUS_OFFLINE,
"inactive": STATUS_INACTIVE,
"bot": BOT_MARKER,
}


Expand Down
17 changes: 16 additions & 1 deletion zulipterminal/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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

Expand All @@ -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
Expand All @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
Expand Down
1 change: 1 addition & 0 deletions zulipterminal/themes/gruvbox_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'user_idle' : (Color.NEUTRAL_YELLOW, Color.DARK0_HARD),
'user_offline' : (Color.LIGHT2, Color.DARK0_HARD),
'user_inactive' : (Color.LIGHT2, Color.DARK0_HARD),
'user_bot' : (Color.LIGHT2, Color.DARK0_HARD),
'title' : (Color.LIGHT2__BOLD, Color.DARK0_HARD),
'column_title' : (Color.LIGHT2__BOLD, Color.DARK0_HARD),
'time' : (Color.BRIGHT_BLUE, Color.DARK0_HARD),
Expand Down
1 change: 1 addition & 0 deletions zulipterminal/themes/gruvbox_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'user_idle' : (Color.NEUTRAL_YELLOW, Color.LIGHT0_HARD),
'user_offline' : (Color.DARK2, Color.LIGHT0_HARD),
'user_inactive' : (Color.DARK2, Color.LIGHT0_HARD),
'user_bot' : (Color.DARK2, Color.LIGHT0_HARD),
'title' : (Color.DARK2__BOLD, Color.LIGHT0_HARD),
'column_title' : (Color.DARK2__BOLD, Color.LIGHT0_HARD),
'time' : (Color.FADED_BLUE, Color.LIGHT0_HARD),
Expand Down
1 change: 1 addition & 0 deletions zulipterminal/themes/zt_blue.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'user_idle' : (Color.DARK_GRAY, Color.LIGHT_BLUE),
'user_offline' : (Color.BLACK, Color.LIGHT_BLUE),
'user_inactive' : (Color.BLACK, Color.LIGHT_BLUE),
'user_bot' : (Color.BLACK, Color.LIGHT_BLUE),
'title' : (Color.WHITE__BOLD, Color.DARK_BLUE),
'column_title' : (Color.BLACK__BOLD, Color.LIGHT_BLUE),
'time' : (Color.DARK_BLUE, Color.LIGHT_BLUE),
Expand Down
1 change: 1 addition & 0 deletions zulipterminal/themes/zt_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'user_idle' : (Color.YELLOW, Color.BLACK),
'user_offline' : (Color.WHITE, Color.BLACK),
'user_inactive' : (Color.WHITE, Color.BLACK),
'user_bot' : (Color.WHITE, Color.BLACK),
'title' : (Color.WHITE__BOLD, Color.BLACK),
'column_title' : (Color.WHITE__BOLD, Color.BLACK),
'time' : (Color.LIGHT_BLUE, Color.BLACK),
Expand Down
1 change: 1 addition & 0 deletions zulipterminal/themes/zt_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'user_idle' : (Color.DARK_BLUE, Color.WHITE),
'user_offline' : (Color.BLACK, Color.WHITE),
'user_inactive' : (Color.BLACK, Color.WHITE),
'user_bot' : (Color.BLACK, Color.WHITE),
'title' : (Color.WHITE__BOLD, Color.DARK_GRAY),
'column_title' : (Color.BLACK__BOLD, Color.WHITE),
'time' : (Color.DARK_BLUE, Color.WHITE),
Expand Down