Commit Graph

1634 Commits

Author SHA1 Message Date
yogesh sirsat 953f026487 compose: Disable unneeded control buttons in preview mode.
Buttons which change the content in the compose textarea were so far
enabled even in preview mode, and would work, but those changes would
not be reflected in the visible preview. This is extremely confusing,
and can lead to the possibility of a user accidentally changing the
content of the compose textarea while previewing, and sending that.

Now we disable those buttons in preview mode, both when composing a new
message and when editing an existing one. We still show the tooltips,
but grey them out and make them unclickable.

Fixes: #20962
2023-09-13 15:09:16 -07:00
Aman Agrawal aaf3369d39 recent_view: Add table header to sort by unread count.
Fixes: #22790
2023-09-13 14:58:13 -07:00
Vector73 5a88e4f6cb notifications: Remove realm-default-sound-audio initialization.
This commit removes the code to initialize
"realm-default-notification-sound-audio" element from
"notifications.initialize", because we do not need this
now as the previous commit added code to initialize it
in "settings_realm_user_settings_default.set_up".

This change works because the realm default notification sound
can only be played from the settings UI and so it is fine to
initialize it only when opening the default user settings panel.
2023-09-13 13:07:10 -07:00
Vector73 f384eb67a9 default-user-settings: Fix play button not playing selected sound.
Fixes #26598.
2023-09-13 13:07:10 -07:00
Aman Agrawal 0723c56246 emoji_picker: Improve rendering time of emoji picker by ~30%.
Fixes #25744

By rendering the emojis after initializing the simplebar container,
the rendering time is decreased by ~30% as observed at 6x CPU
cooldown on mac i7.
2023-09-13 12:39:13 -07:00
Daniil Fadeev 2f1561e3b8 giphy: Fix giphy popover rendering on narrow screens.
We should render the giphy popover as a centered overlay for
mobile-sized screens.
2023-09-13 12:20:35 -07:00
Daniil Fadeev b7c2570933 giphy: Refactor the giphy popover to use toggle_popover_menu.
This change is needed so we can use the `use_as_overlay` option on
mobile screens.
2023-09-13 12:20:35 -07:00
Daniil Fadeev 5b0e74c940 user_card_popover: Rename `show_*` functions to `toggle_*`.
This naming more accurately reflects the functionality of these types
of functions. They are not only responsible for displaying the
popovers but also for toggling them off.
2023-09-13 11:49:12 -07:00
Daniil Fadeev e5da3d9900 user_card_popover: Extract user card popover data into a new function.
The purpose of this change is to simplify the
`render_user_card_popover` function, so it has the single
responsibility of just rendering.
2023-09-13 11:49:12 -07:00
Daniil Fadeev c5f6c00a81 popovers: Extract user info popovers into their own module.
The intent behind this commit is to tidy up how we handle user info
popovers. The first step is to move everything related to them into
its own module. This commit should not have any functional changes.
2023-09-13 11:49:08 -07:00
Daniil Fadeev 64f77b1dee popovers: Stop exporting `toggle_playground_link_popover` function.
This function is only used in the `popovers.js` module, so there's no
need to export it.
2023-09-13 11:48:31 -07:00
Daniil Fadeev 7bcb868f9a popovers: Use a special function to check if the popover is open. 2023-09-13 11:48:31 -07:00
Daniil Fadeev 257c327f39 user_profile: Move event registration to the correct place.
The event callback that was moved is part of `user_info_popover` and
should be registered along with the other actions of this popover.
2023-09-13 11:48:31 -07:00
Daniil Fadeev 523b5a0877 popovers: Remove unused functions from `popovers.js` module. 2023-09-13 11:48:31 -07:00
Daniil Fadeev 0a11a4b983 notifications: Extract notification title retrieval.
This commit aims to extract all logic related to obtaining
notification title from the `process_notification` function into
a separate `get_notification_title` function.
2023-09-13 11:18:35 -07:00
Daniil Fadeev fe5d680f27 notifications: Refactor `process_notification` function.
Turned multiple if statements into a switch/case and rearranged
variable declarations.
2023-09-13 10:55:59 -07:00
Daniil Fadeev 8b8f95b6f5 notifications: Extract sender name removal from recipients list. 2023-09-13 10:55:59 -07:00
Daniil Fadeev 53ef273665 notifications: Extract notification key retrieval.
This commit aims to extract all logic related to obtaining
notification key from the `process_notification` function into a
separate `get_notification_key` function.
2023-09-13 10:55:59 -07:00
Daniil Fadeev fdac13ba24 notifications: Extract `notification_source` debugging logic.
This commit aims to extract all logic related to debugging the value
of `notification_source` from the `process_notification` function into
 a separate `debug_notification_source_value` function.
2023-09-13 10:55:59 -07:00
Daniil Fadeev a11dedd393 notifications: Extract notification content retrieval.
This commit aims to extract all logic related to obtaining
notification content from the `process_notification` function into a
separate `get_notification_content` function.
2023-09-13 10:55:59 -07:00
Daniil Fadeev 8d0a70b6b9 notifications: Simplify if statement.
Since `pm_content_in_desktop_notifications` is a boolean, there's no
need to check if it's undefined.
2023-09-13 10:55:59 -07:00
Tim Abbott ba22433dd9 stream_popover: Inline register_stream_handlers.
Also register these click handlers just on the popover itself directly
in the onMount helper, like we do with all the other popover_menus.js
functions.
2023-09-13 10:55:40 -07:00
Daniil Fadeev 08aec5ac41 stream_popover: Migrate from Bootstrap to Tippy. 2023-09-13 10:55:40 -07:00
Daniil Fadeev f2f0462e09 stream_popover: Rename stream_popped to is_open.
stream_popover.is_open() much more accurately describes what this
does, and in particular the fact that the function applies to all
places the stream popover might be.
2023-09-13 10:55:40 -07:00
Daniil Fadeev 35d97160bc stream_popover: Use currentTarget as reference to the stream popover.
Using currentTarget as a reference element guarantees us that the
relative placement will be the same every time.
2023-09-13 10:55:40 -07:00
Daniil Fadeev e0f72de75c stream_popover: Update the comment that describes the module. 2023-09-13 10:55:40 -07:00
Daniil Fadeev 71de1c2a66 popovers: Use `media_breakpoint_num` instead of a constant value. 2023-09-13 10:55:40 -07:00
Aman Agrawal a8e1c22687 inbox: Add support for vim keys. 2023-09-12 09:20:33 -07:00
Aman Agrawal 6c179bcc48 inbox: Show focus underline for non-dm rows. 2023-09-12 09:20:33 -07:00
Aman Agrawal 58c5701e5e css: Assign a variable to focus underline color of recent view. 2023-09-12 09:20:33 -07:00
Aman Agrawal f12fe219d9 inbox: Sort pinned streams at the top. 2023-09-12 09:20:33 -07:00
Aman Agrawal 4559a9fbf3 inbox: Save collapsed state of streams in localstorage. 2023-09-12 09:20:33 -07:00
Aman Agrawal 6ef0753a51 inbox: Add new narrow. 2023-09-12 09:20:33 -07:00
Anders Kaseorg 3d7b9e622d web: Avoid several unchecked TypeScript casts.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:04:55 -07:00
Anders Kaseorg 4650b789ce browser_history: Delay user_settings.default_view evaluation.
Commit 61f7ede43c (#25759) introduced a
bug: browser_history tried to access user_settings.default_view at top
level as soon as it was imported, before
user_settings.initialize_user_settings has been called, so
browser_history.state.spectator_old_hash was always initialized to
"#undefined".

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-11 18:04:55 -07:00
Prakhar Pratyush 20886b80d9 topic_list: Update the order of "Followed" topics in the muted stream.
For sorting topics in the left sidebar topics list, the "Followed"
topics are treated the same as "Unmuted" topics.

In a muted stream and not zoomed state:
* followed/unmuted topics at the top.

In an unmuted stream or zoomed state in a muted stream:
* normal recency sorting

The reason is that the "Followed" topics have a tier of interest
above being unmuted, so they shouldn't lie below the "Unmuted" topics
in the list.
2023-09-11 17:55:37 -07:00
Prakhar Pratyush 5d069b7d7a topic_list: Add an icon and update the color for "Followed" topics.
This commit adds the follow icon to the right end
(before the three-dot menu icon) of the topic list item
for followed topics.

The icon replaces '@' instead of showing both the '@' and "Follow"
icons in the case of unread mentions, as users don't care if they
are following a topic if they've got unread mentions there.

In a muted stream, the text color of followed topics in the topic list
is set to be similar to that of unmuted topics.

The reason is that the followed topic has a tier of interest above
being unmuted, so it shouldn't stay faded in the topic list.
2023-09-11 17:55:35 -07:00
Prakhar Pratyush 07fd2aa344 topic_list: Add a CSS variable for the unmuted topic's color.
This commit adds the CSS variable '--color-unmuted-topic-list-item'
for the unmuted topic's color in the topic list.

The color for both the light and dark themes is defined in
'zulip.css' and used in 'left_sidebar.css'.

This approach helps to remove the use of the selector 'unmuted_topic'
only for color definition in 'dark_theme.css'.
2023-09-11 17:12:21 -07:00
Lalit Kumar Singh 5f74b9051e ts: Migrate `user_topics.js` to typescript. 2023-09-11 10:57:38 -07:00
Lalit Kumar Singh dc142ab1d1 fold_dict: Use `IterableIterator` instead of `Iterator`.
The type `Iterator` does not allow us to loop over the iterator in a `for`
loop. but `IterableIterator` does.
2023-09-11 10:57:38 -07:00
Lalit Kumar Singh d82b3625f1 user_topics: Pop `user_topics` from `page_params`.
This avoids accessing the global page_params directly.
2023-09-11 10:57:38 -07:00
Daniil Fadeev a2b4db07f6 emoji_picker: Move module event registration to initialization. 2023-09-11 10:42:18 -07:00
Tim Abbott b0007bf5ca settings: Navigate to profile to edit self in users panel.
We don't have a "Manage user" tab in your own profile, so it would
throw an exception to do the default thing here, and the mechanism for
editing your own settings should be the main "your profile" panel,
which is a bit bigger and more user-friendly.

I'm not totally convinced that the extra logic for not having a
"Manage user" tab is worth it; the alternative of figuring out a
non-confusing label would not be terrible here. But this version is
non-broken, and it'll be easy to change later if we change our mind.
2023-09-11 10:39:00 -07:00
Tim Abbott 0174902b73 user_profile: Centralize footer logic. 2023-09-11 10:39:00 -07:00
palashb01 db47f675f0 user_profile: Add tippy tooltips to edit pencil button.
This commit adds Tippy tooltips to the edit pencil button
in the user profile. Now, when a user opens another user's
profile, they will see the tooltip 'Manage user', and when
they open their own user profile, they will see the tooltip
'Edit profile'.
2023-09-11 10:39:00 -07:00
palashb01 1c049ab5f4 user_profile: Replace the id with class for pencil button.
This commit replaces the id attribute with class attribute for the
edit pencil button in user profile modal.
2023-09-11 10:39:00 -07:00
palashb01 135518435a user_profile: Align the title header of the modal and fix edit button.
This commit unsets the padding of the bot icon and, as the anchor
tag has been replaced with the i tag, we have also set the color
and pointer. This is done so that when the user hovers over the
icon, it will appear as a clickable button.
2023-09-11 10:39:00 -07:00
palashb01 f9dd2db3e4 user_profile: Move bot icon to the left of the name.
This commit moves the bot icon to the left of the name in the user
profile and adds a margin-left and margin-right to the name to ensure
there is enough space between the icon, name, and edit pencil.
2023-09-11 10:39:00 -07:00
palashb01 c6bb7b9169 user_profile: Redirect edit pencil to manage user tab.
This commit redirects the edit pencil in the user profile modal to
the 'manage user' tab whenever a user with permission to manage
other users via the user profile opens another user's profile.
However, we still want to redirect the edit pencil to
'settings/profile' if the user opens their own profile. The user
management permission is granted if the user is an admin or the
owner of the bot. However, we do not want system bots to have
access to the edit pencil or the 'manage user' tab. Therefore,
a new variable called 'can_manage_profile' has been introduced
to manage all these permissions, and the CSS has been updated
accordingly.

To redirect to the manage user tab without opening another modal,
I have extracted the toggler. This toggler will store the
component, and if the edit pencil button is clicked, we can use
the goto function to redirect to a different tab.

Changed the id names of both the edit pencil icons to explain
better of what they do.
2023-09-11 10:39:00 -07:00
palashb01 e1322faae0 user_profile: Fix the gap between labels and input.
This commit increases the gap between the labels and input/select
of the user profile manage user/bot tab for clearer visibility.
It also reduces the gap between the 'deactivate user' button and
the last input to make it look better.
2023-09-11 10:39:00 -07:00