Commit Graph

5291 Commits

Author SHA1 Message Date
evykassirer f23fdede67 search pills: Align icons on top row.
This reverts #30804. We need a followup PR to address the
issue that PR was trying to solve without breaking icon
alignment.
2024-07-13 11:38:11 -07:00
Vector73 d895ca287f tooltips: Make size of tooltips consistent.
Uses a variable for defining font-size on tooltips instead of `1em`.
2024-07-13 07:34:21 -07:00
Tim Abbott b747bd4487 narrow_state: Disable coverage requirement for unlikely case.
I'm not actually sure if this is possible; it's been copy/pasted from
the channel/topic code path, but even with that one, it seems like the
topic being `undefined` is impossible (that's not how operators work),
and the channel being undefined might be something that should fail in
`Filter` initialization, not here.
2024-07-13 07:28:52 -07:00
Aman Agrawal 70be9e8c51 narrow: Implement rendering of `with` narrow operators.
Adds server and web app support for processing the new `with`
search operator.

Fixes part of #21505.

Co-authored-by: roanster007 <rohan.gudimetla07@gmail.com>
Co-authored-by: Tim Abbott <tabbott@zulip.com>
2024-07-13 07:18:24 -07:00
Vector73 e9b796c0be group_settings: Change tooltip on add members input box. 2024-07-13 07:04:08 -07:00
Aman Agrawal b5b3391d0d typeahead: Fix alignment of secondary text of typeahead. 2024-07-13 07:03:46 -07:00
Aman Agrawal a46b075e0e typeahead: Restore line height to original value.
e5e5ba6cea reduce the line height
of the typeaheads, which doesn't look for stream typeaheads. We
restore it back to original value.
2024-07-13 07:03:46 -07:00
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 5b57ed959e user_pill: Use group pills to add all users.
Fixes #30690.

Before this, we were adding all users to subscriber list without adding
any pill. But, since we want pills to be the source of truth for adding
the subscribers, we will just add the `role:everyone` pill from now on
whenever `Add all users` is clicked.

While we can just directly call `pill_widget.appendValue` in
`stream_create_subscribers`, it's better to expose an API from
`add_subscribers_pill` and use that. This lets us control how appending
an item would work for subscriber pill in a single place.
2024-07-12 15:22:50 -07:00
Shubham Padia 2b572628d0 user_group_popover: Don't show group settings link for system groups.
System groups are immutable and that's why we should remove the group
settings link from the group popover for system groups.
2024-07-12 15:22:50 -07:00
Shubham Padia 20f83b944f user_group_popover: Add support for displaying subgroup members.
We list all the members of a group including recursive subgroup members
in the user group popover.

We also add another change in this commit to show `Everyone` if the
group name is `role:everyone` by using
`user_groups.get_display_group_name`.
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
Shubham Padia 9f7dc596f8 user_groups: Add get_recursive_group_members.
This function goes through all subgroups recursively and returns the
resultant set of the members of those subgroups in addition to the
members of our target_group.

This function is required in order to add the `everyone` pill to create
channel flow.

For the tests written in this commit, it uses the same pattern as the
`get_recursive_subgroups` test.

`is_user_in_group` could have been technically refactored to use
`get_recursive_group_members`, but since the former returns early for
direct members, I've let it be for now.
2024-07-12 15:22:50 -07:00
Shubham Padia c7e59ed761 user_group_pill: Remove unnecessary truthy filter on user_ids.
The filter was not doing anything to the user_id array, not sure why it
was introduced in ce4cf66f3f.
2024-07-12 15:22:50 -07:00
Kislay Verma ffd49ac35b compose: Transform stream/topic urls on paste.
Transforming valid stream/topic urls  to the #**stream>topic**
syntax.
- A valid url contains a stream and optionally a topic
 but nothing else, and in that order.
 It must belong to the same origin as the Zulip server.
 The stream id present in the pasted url should
  correspond to an actual stream in the current
  server.
- `near` links are not transformed.
- Use-mention distinction is respected by
  not transforming a valid url if pasted using
  `Ctrl+Shift+V`.
- No transformation occurs inside a code block.
-  On pressing `Ctrl+Z` after pasting,
  the actual pasted link is restored.
- No transformation occurs if the url is pasted over an
 existing url in a markdown link syntax.
- No transformation occurs if the stream or topic name
contained in the pasted url is known to produce broken
 stream/topic syntax links (as per #30071).

Fixes #29136
2024-07-12 15:15:10 -07:00
evykassirer 2e3f11134e search: Fix bug where exit button jumps when clicked. 2024-07-12 15:14:05 -07:00
adnan-td 6f4d14ddde stream_pill: Add channel privacy icons in input_pill.
Modify stream pills to add channel privacy decorations inside
input pills for areas eg: the UI for adding members to a channel.

Partly fixes: #25257.
2024-07-12 15:00:02 -07:00
evykassirer 9e096382cd search pills: Fix bug closing multiple pills on fresh open.
`on_search_contents_changed` resets the search bar on input
change in the "freshly opened" state. We shouldn't be calling
this when removing pills, since removing pills should always
remove the freshly opened state, not reset the search bar.

This bug was reported on CZO:
https://chat.zulip.org/#narrow/stream/9-issues/topic/.F0.9F.8E.AF.20message.20search.20'x'.2Fdelete/near/1883828
2024-07-12 14:59:03 -07:00
evykassirer 31ed5d597b search: Enlargen x button in search bar. 2024-07-12 13:36:42 -07:00
evykassirer 57cb4321b1 search pills: Align typeahead text with pills. 2024-07-12 13:25:36 -07:00
Tim Abbott 4b6393955b buddy_list: Rename total_subscriber_count for clarity. 2024-07-12 13:10:44 -07:00
Tim Abbott 4228d32639 buddy_list: Rewrite total_subscriber_count.
This much more simply does what it sounds like it does.
2024-07-12 13:10:44 -07:00
Pratik Chanda 503b66f52a buddy_list: Fix incorrect user count in sidebar with bot as recipient.
Earlier in right sidebar user count, it would show less user count
when a bot was present as a recipient in the conversation. Since the
sidebar shows active human users only, user count should not
consider bots in the conversation.

This commit fixes the behaviour by adding all the subtracted bots
in from user count.
2024-07-12 13:10:44 -07:00
Sayam Samal 757bb8c68d user_card_popover: Update `max-width` to scale UI with font size.
This commit updates the `max-width` of popovers to relative length units
to allow the UI to scale with the font-size.

The `max-width` of `97vw` still applies to the popover, and ensures
that the UI does not overflow the viewport.
2024-07-12 13:03:40 -07:00
Sayam Samal 724c91d127 user_card_popover: Add user-card-specific class to the email field. 2024-07-12 13:03:40 -07:00
Sayam Samal 50645ffd7e user_card_popover: Use different selector for clear status tooltip. 2024-07-12 13:03:40 -07:00
Sayam Samal a20ac9a831 user_card_popover: Fix keyboard nav for right sidebar popovers. 2024-07-12 13:03:40 -07:00
Sayam Samal 97f84b4aae user_card_popover: Scope related css inside a common class. 2024-07-12 13:03:40 -07:00
Sayam Samal ad121335e3 user_card_popover: Add medium avatar back on mount. 2024-07-12 13:03:40 -07:00
Tim Abbott df1fc71685 user_card_popover: Skip copy icon for keyboard focus.
It's invisible unless the email is cropped, and even if it weren't,
the menu is more likely of interest to a keyboard user.
2024-07-12 13:03:40 -07:00
Tim Abbott 94a0941b0c user_card_popover: Fix on_mount hooks not being called.
The extra undefined parameter appears to be a bug introduced in
5142f1279a45d00320904b369b092f0c9c116b90; when the show_as_overlay
parmater was dropped, the other callers to show_user_card_popover did
not have their extra argument removed.

This had the effect of not setting initial keyboard focus when opening
the popover.
2024-07-12 13:03:40 -07:00
Sayam Samal 6ee491697f user_card_popover: Improve outline styling for focused elements.
- Adds focus outline to the custom profile field links.
- Replaces the grey outline of the copy and status buttons with the
  blue one used across the popover options.
- Adds hover state styling to the focus state styling for the copy
  buttons.
2024-07-12 13:03:40 -07:00
Sayam Samal 7232ff68f8 user_card_popover: Enable keyboard nav for custom field copy buttons. 2024-07-12 13:03:40 -07:00
Sayam Samal 8ead2035bf user_card_popover: Enable keyboard navigation for email copy button. 2024-07-12 13:03:40 -07:00
Sayam Samal 2ee9d80c7f user_card_popover: Add tooltip for status clear button.
Previously, the tooltip for the status clear button was scoped to only
the personal menu popover. This commit moves that logic to `tippyjs.ts`
and adds support for the status clear button in the user card popover.
2024-07-12 13:03:40 -07:00
Sayam Samal 1f6fcb81e8 user_card_popover: Cleanup user card popover after redesign.
As a follow-up to the user card popover redesign, this commit removes
the unused code and styles from the user card popover.

- Removed tooltip logic for user name and user type, since we now
  display them in full without any ellipses.

- Removed unused css whose class names are no longer used in the
  user card popover.

- Removed additional styling needed to handle font awesome and zulip
  custom icons, used in the older design.
2024-07-12 13:03:40 -07:00
Sayam Samal 5a123e57ce user_card_popover: Align user info to popover header's vertical center.
This commit aligns the user info, which contains the user's full name
and type, to the vertical center of the user card popover's header.

With this, the user info is aligned in the center of the popover header
for short names, and then for the longer names, the user info eventually
aligns to the top and the rest of the content are pushed down.
2024-07-12 13:03:40 -07:00
Sayam Samal dd2739a7e1 user_card_popover: Update the hover and active colors of copy button.
Using the new color palette defined in the previous commit, this commit
updates the hover and active colors of the copy button in the user card
popover.

This also adds a background to the copy icon on hover and active states.
2024-07-12 13:03:40 -07:00
Sayam Samal 84bf694257 css: Add Zulip color palette to app_variables.css.
This commit adds the new Zulip color palette, as css custom properties
to the app_variables.css file. Defining it in the app_variables.css file
allows us to visualize the colors in the editor's autocomplete dropdown
when we use these color values for defining other component based css
variables.

Since hex color values are used in defining the color palette, we
disable the `color-no-hex` stylelint rule for that part of the file.
2024-07-12 13:03:40 -07:00
Sayam Samal d707c9f779 user_card_popover: Change success behavior of the email copy button.
Previously, when the email was successfully copied via the email copy
button, the email in the user card popover was replaced with a "Email
copied!" message.

This commit replaces this behavior with a more subtle approach, where
only the tooltip of the email copy button changes to "Copied!".
2024-07-12 13:03:40 -07:00
Sayam Samal eb5bef8ff5 user_card_popover: Redesign user card popover for unknown user.
This commit extends the user card popover redesign to the case where
the guest is not allowed access to view some of the other users'
profiles due to a change in the
"Who can view all other users in the organization" permission.

Fixes #27338.
2024-07-12 13:03:40 -07:00
Sayam Samal 9bd8a0c72c user_card_popover: Move manage user menu options to user card popover.
This commit removes the manage user menu popover and moves the
options contained within it directly to the parent user card popover.
2024-07-12 13:03:40 -07:00
Sayam Samal 7a903e6336 user_card_popover: Align status emoji to the top for multi-line status. 2024-07-12 13:03:40 -07:00
Sayam Samal 258e2a7297 user_card_popover: Fix clear status icon padding.
The clear status icon was not properly aligned with the text in the user
card popover, due to additional padding on the icon. The reason for this
padding was to ensure correct focus ring offset, so to fix this issue,
without breaking the focus ring, this commit sets the `outline-offset`
to `0`.
2024-07-12 13:03:40 -07:00
Sayam Samal 58357dfd75 user_card_popover: Fix user avatar shrinking on long status text. 2024-07-12 13:03:40 -07:00
Sayam Samal 60d1993ed8 user_card_popover: Redesign popover using the new `popover-menu` theme.
As part of the popover menu redesign, this commit redesigns the user
card popover using the new "popover-menu" tippy theme and improves
accessibility by using appropriate ARIA attributes.
2024-07-12 13:03:40 -07:00
Shubham Padia c5d70cdc1d settings: Do not execute hotkey inside any users tab filter input.
We changed the scope of the selector to just the switcher. This means
that the hotkeys will only run when the user focuses on that element.
This follows the same pattern as the `Personal` and `Organization` tab
switchers which limit the hotkey area to their tab list and not the
content. If we want to use hotkeys inside the content, just filtering
out INPUT elements in keydown_util might be better.
Fixes https://chat.zulip.org/#narrow/stream/9-issues/topic/.F0.9F.8E.AF.20Org.20settings.20user.20search.20does.20not.20work.20with.20vim.20hotkeys.2E/near/1882313
2024-07-12 11:51:40 -07:00
Shubham Padia a2f2b52c2d left_sidebar: Stop event propagation on DM filter click.
Before this, in the onclick event for
`#direct-messages-section-header.zoom-in`, we were filtering out the
class for the direct messages filter, and not activating a narrow on
trying to input on the filter. This was fragile, so we've added an
onclick listener to the direct messages filter which will do nothing
else than stopping the event propagation upto direct messages section
header.
Fixes https://github.com/zulip/zulip/pull/30332#discussion_r1669198527.
2024-07-12 11:32:49 -07:00