Commit Graph

7 Commits

Author SHA1 Message Date
Shubham Padia 054f08c6df user_group_pill: Exclude inactive members from pill.
While using the pill in `stream_create`, it was noticed that deactivated
users were also part of the user_ids returned by the user_group_pill,
which we do not want to do.
This pill is used in two areas: compose box and stream create/edit.
This commit will only affect stream create/edit since compose box was
just using the typeahead data from user_group_pill and nothing else.
Stream and user pill handle inactive users already, so no change is
needed there.
2024-07-12 15:22:50 -07:00
Shubham Padia e9166fe6f7 user_group_pill: Internationalize display_pill string. 2024-07-12 15:22:50 -07:00
Shubham Padia be5e0d4648 user_group_pill: Hardcode `Everyone` in display name.
For system groups, the directive is that we should use the description
as the display name. But in case of `role:everyone`, the description is
`Admins, moderators, members and guests`, while for the
`user_group_pill`, we want to display a simpler and succinct message:
`Everyone`. We've only hardcoded this for user_group_pill since we don't
want to display the name as `Everyone` anywhere else yet.

We've also exposed a method called `get_display_group_name` which will
be used in later commits to get the group display name.
2024-07-12 15:22:50 -07:00
Shubham Padia 458038b384 user_group_pill: Add support for subgroups.
While the support to include all members of a subgroup is needed only in
the `stream_create` context for now, we have added the support for
subgroups to `user_group_pill` for all cases. We have done this because
that is still going to be the correct behaviour if we add similar
support to other pill inputs.

In terms of calculating and populating the recursive member list, it was
decided not to do it when initializing the user_groups data. One reason
for that was it would introduce a lot more complexity when adding or
removing members from any of the subgroups to keep the recursive member
list updated. Keeping in line with the general pattern of calculating
recursive subgroups on the fly too, it was decided to calculate the
recursive list of members on the fly too.

Also changes the `get_group_ids` tests to make sure that subgroup ids
are not part of the result of `get_group_ids`. Since it is used to
calculated taken_groups, we don't want to filter out subgroups as part
of taken_groups and their typeahead should still be visible.
2024-07-12 15:22:50 -07:00
PieterCK 3b46d0e53c settings: Refactor UserGroupPill to improve consistency.
Changed UserGroupPill's 'id' key to 'group_id' because
UserPill uses 'user_id' instead of only id.
2024-05-17 10:47:22 -07:00
Lalit 61d4670f9a user_group_pill: Add test coverage for `append_user_group`. 2023-07-17 10:38:24 -07:00
Anders Kaseorg cea1119423 node_tests: Move to web/tests.
This lets us simplify the long-ish ‘../../static/js’ paths, and will
remove the need for the ‘zrequire’ wrapper.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-23 16:04:17 -08:00