Commit Graph

5074 Commits

Author SHA1 Message Date
Sahil Batra 9d1dc20e6e settings: Remove realm-level email_address_visibility setting.
This was replaced by the new user-level version in recent commits.

Fixes #20035.
Fixes #18149.
2023-02-10 17:40:33 -08:00
Sahil Batra b84885184e settings: Use user-level email_address_visibility setting in UI.
This commit basically updates the frontend code to directly use
delivery_email field instead of functions like show_email or
email_for_user_settings at places where we want to show email.
We can do this change since we recently updated the server code
to always pass "delivery_email" code in the user objects with its
value being null if the real email is not accessible.

Showing email or "hidden" or nothing at various places in UI like
in users list, subscriber list, user profile popover and modal is
same as before.

Major points -

- Removed show_email and email_for_user_settings functions since we
directly use delivery_email field now as explained above.

- While sorting by emails in the users list, users with real emails
hidden are always shown in last when sorting alphabetically and at
the top when sorting reverse alphabetically. Also, those users with
real emails hidden, are sorted by name among themselves. As we did
before, we do not allow sorting by email when all emails are hidden.

- There is no change in typeahead behavior at this point. We either
hide the email completely or show the real or fake email based on
user level setting.

- Added code to handle delivery_email events and appropriately add/remove
delivery_email field from person objects.
2023-02-10 17:35:50 -08:00
Sahil Batra 2396e6858f users: Always pass "delivery_email" field in user objects.
Previously, user objects contained delivery_email field
only when user had access to real email. Also, delivery_email
was not present if visibility setting is set to "everyone"
as email field was itself set to real email.

This commit changes the code to pass "delivery_email" field
always in the user objects with its value being "None" if
user does not have access to real email and real email otherwise.
The "delivery_email" field value is None for logged-out users.
For bots, the "delivery_email" is always set to real email
irrespective of email_address_visibility setting.

Also, since user has access to real email if visibility is set
to "everyone", "delivery_email" field is passed in that case
too.

There is no change in email field and it is same as before.

This commit also adds code to send event to update delivery_email
field when email_address_visibility setting changes to all the
users whose access to emails changes and also changes the code to
send event on changing delivery_email to users who have access
to email.
2023-02-10 17:35:49 -08:00
Lauryn Menard 81d1be011d node-tests: Remove unnecessary mock in compose_actions node test.
In commit 0d373e574b, the use of `common.status_classes` was
removed from `compose_actions.js`, so there is no longer a need
to mock it in the related node test.
2023-02-10 10:39:22 -08:00
Lauryn Menard 1ddc27d91b pm-list-data: Remove unused `is_all_privates` function.
In commit 6f9e97921, the last use of `pm_list_data.is_all_privates`
was removed when we restructured how private messages are shown
in the left sidebar. Removes the function since it is now no longer
relevant.
2023-02-10 10:38:55 -08:00
Zixuan James Li 9808bdf1d3 typeahead: Ensure presence of is_realm_emoji.
The implementation of the emoji sorter relies on the presence of the
"is_realm_emoji" property. We want to be consistent with this
assumption.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-02-09 16:51:40 -08:00
Zixuan James Li 6e9079f876 typeahead: Remove is_unicode_emoji.
This avoids the type narrowing problem when we call "is_unicode_emoji"
on an emoji object and access "emoji.emoji_code", which might be
"undefined".

In places where these helpers are accessed, we expect that
"reaction_type" is always present so that we can later correctly type
narrow Emoji into UnicodeEmoji. This updates the test cases to
respect that.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-02-09 16:51:40 -08:00
Anders Kaseorg ec58b6790d install-node: Upgrade Node.js to 18.14.0; manage Yarn with Corepack.
Corepack manages multiple per-project version of Yarn and PNPM, which
means we have to maintain less installation code, and could help us
switch away from Yarn 1 without making the system unusable for
development of other Yarn 1 projects.

https://nodejs.org/api/corepack.html

The Unicode spaces in the timerender test resulted from an ICU
upgrade: https://github.com/nodejs/node/pull/45068.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-09 15:50:47 -08:00
Tim Abbott b9fc5da350 tooltips: Fix hotkey-hint CSS class reuse.
The "hotkey-hint" class name used internally in
d66f2d900f conflicted with the
preexisting class name for hotkey hints into popovers, introduced in
80ff3d8da5.

Given that the new class is for a styling of hotkey hints designed for
use in tooltips, it was a bad name anyway, so just rename it to
tooltip-hotkey-hint. We rename the related cluster of variable names
to match this.
2023-02-08 13:13:35 -08:00
Sahil Batra 2fcaf88305 message_edit: Add code to live-update inline-topic edit icon.
This commit adds code to live-update the inline-topic edit
icon on changing move_messages_within_stream_limit_seconds
or edit_topic_policy. We simply rerender the message list
as it becomes difficult to check for each recipient row
and update it because topic edit permission depends on
when the message was sent.

This also live-updates the resolve topic icon as it depends
on topic edit permission only.
2023-02-08 12:46:05 -08:00
Sahil Batra 2eb204f699 settings: Add move_messages_between_streams_limit_seconds element in UI.
This commit adds dropdown for move_messages_between_streams_limit_seconds
setting which is used to control for how long the user is allowed to
edit stream.
2023-02-08 12:46:05 -08:00
Sahil Batra 4378b1639d settings: Add move_messages_within_stream_limit_seconds element in UI.
This commit adds dropdown for move_messages_within_stream_limit_seconds
setting which is used to control for how long the user is allowed to
edit topic.
2023-02-08 12:46:05 -08:00
Sahil Batra 03df1c16f1 message_edit: Use move_messages_between_streams_limit_seconds in webapp.
This commit adds code to check time limit as per recently added
move_messages_between_streams_limit_seconds setting when moving
messages between streams in webapp. There is no time limit for
admins and moderators.

We add a new function "is_stream_editable" (similar to already
existing is_topic_editable function) to check whether user is
allowed to move message between streams.
2023-02-08 12:46:05 -08:00
Sahil Batra d514f2455f message_edit: Use move_messages_within_stream_limit_seconds in webapp.
We now use realm_move_messages_within_stream_limit_seconds setting in
webapp to check topic edit permission replacing the 3-day limit.
As was the case previously, there is no limit for admins and
moderators.
2023-02-08 12:46:05 -08:00
Aman Agrawal 4dfe3d36e0 floating_recipient_bar: Replace with sticky header. 2023-02-07 16:25:39 -08:00
Pranav2612000 c58f38dae3 compose: Show resolve topic banner only once per narrow.
Previously, when sending a message to a resolved topic, if you disissed
the 'You are sending a message to a resolved topic' banner, it would
reappear as soon as the user enters another character.

Fix this by showing the banner at most once per narrow. It does not
reappear if the user closes the banner and continues typing.  It will
only be shown again if the user closes compose, changes stream/topic,
sends a message or otherwise clears the compose box state.

We also remove the existing check for whether this banner is already
visible; this is essentially a more precise version of the same logic.

Fixes #24245.
2023-02-07 15:53:25 -08:00
m-e-l-u-h-a-n 9d6cc8142b user groups: Add support for add_member and remove member events. 2023-02-07 15:12:56 -08:00
m-e-l-u-h-a-n 1f03042a48 user groups: Add support for removing user groups.
The new `#groups` overlay had no way for user groups to be deleted.
This commit adds UI support for removing user groups along with
adding support for live update of `#groups` overlay on remove
event for user groups.
2023-02-07 15:12:56 -08:00
m-e-l-u-h-a-n c0cd6f7f04 user groups: Add support for user group update event. 2023-02-07 15:12:56 -08:00
m-e-l-u-h-a-n 6147f2bd7a user groups: Add live update support for user_group add event.
We add live update support for user group events as part of
https://github.com/zulip/zulip/issues/19526.
This however has a few TODOs:
1. Deciding on how we want to sort the group list on left of
   #groups overlay.
2. How we highlight the newly created groups after it is added
   to the list.
These will be covered as we add support for more groups events.
2023-02-07 15:12:56 -08:00
sayamsamal 0f213f13ff tooltips: Add support for modifier key conversion for mac-syle keyboards.
We scan a tooltip for any required windows-to-mac hotkey conversions
from the list of attributes supplied to the hotkey_hints helper.

If we find any, we add/modify the hotkyes in the hotkey hints list to
match the mac-style key combinations and then return back the modified
list of hotkey hints to be displayed in the tooltip.

We also rename the "adjust_mac_shortcuts" function, used for the
keyboard shortcuts menu and help center documnets, to
"adjust_mac_kbd_tags" to avoid any ambiguity with the
adjust_mac_tooltip_keys funtion which is used for tooltip hotkeys.
2023-02-06 18:41:31 -08:00
sayamsamal d66f2d900f tooltips: Add hotkey hints support for tooltips.
We add the support for hotkey hints for the tippyjs tooltips through
the hotkey_hints handlebar helper.

The hotkey_hints helper takes space seperated string arguments and
returns a span containing all the hotkeys with the required classes
for styling.

We also add a simple node test for the hotkey_hints handlebar helper.

Part of #21753
2023-02-06 18:41:31 -08:00
evykassirer 0d373e574b compose: Remove remaining instances of compose-send-status.
All banners that used to be rendered here are now in #compose_banners.
2023-02-06 16:01:51 -08:00
Ujjawal Modi 836b9e483e settings: Improve permissions banners on Invitations panel.
Fixes #24158
2023-02-06 15:04:56 -08:00
Tim Abbott b36b04e385 user profile: Use stream_data.can_unsubscribe_others.
This is necessary to offer the "Unsubscribe" button in full user
profiles when the current user has the necessary permissions for a
given stream.

We remove settings_data.user_can_unsubscribe_other_users, since we've
changed its only caller and it is no longer a useful abstraction.
2023-02-05 14:46:36 -08:00
Sahil Batra 255dc759b1 stream_settings: Add live update code for can-remove-subscribers-group.
This commit adds code to live update the UI element for
can_remove_subscribers_group setting.
2023-02-05 14:46:36 -08:00
Sahil Batra 37964b1ccc user_groups: Add helper functions to get options for group-based setting.
This commit adds get_realm_user_groups_for_dropdown_list_widget function
which returns the list of objects containing the display name and id
of system user groups and adds tests for this function.
2023-02-05 14:46:36 -08:00
Sahil Batra 73a378d23f stream_settings: Use can_remove_subscribers_group setting in webapp.
This commit updates the frontend to show or hide the "Unsubscribe"
button in subscribers list in stream settings as per the
can_remove_subscribers_group setting for the stream.
2023-02-05 14:46:36 -08:00
evykassirer 9881760796 upload: Rename upload.js get_item keys to reflect upload banner.
Previously the banner was displayed through send_status, but
that is no longer an accurate name for identifying parts of
the upload HTML.
2023-02-04 19:50:52 -08:00
evykassirer 97d355fa72 compose: Migrate upload banner to new banner styling.
Fixes #22524.

This affects both the banner in the main compose box and the banner
in the message edit compose box. The use of ProgressBar has been
replaced with a more simple CSS (with light Javascript) solution.

The classnames are changing because the upload banner is now a
template rendered and remove()-ed from a banner container
(#compose_banners in the composebox, and a new div for banners in the
message edit view). It used to be in the send_status container so
there are a lot of class renames across the codebase.
2023-02-04 19:50:52 -08:00
evykassirer b01ac3623f upload: Remove and reduce timeouts for closing upload bar.
This timeout was introduced in this commit: 02c3223985

The UI should close immediately when the user clicks cancel,
and the rest of the canceling code can run behind the scenes.

We want to keep a short timeout for upload completion
so that the user sees the 100% complete upload bar.
2023-02-04 19:50:52 -08:00
evykassirer beef7611da upload tests: Move compose_ui out of mock_esm. 2023-02-04 19:50:52 -08:00
evykassirer 5f59ea0036 compose banner: Consolidate two functions that clear success banners.
Previously notifications.clear_compose_notifications was used accross
the codebase. Since introducing the new
compose_banner.clear_message_sent_banners function, the two functions
are similar enough that we can just use clear_message_sent_banners
everywhere. This commit also moves scroll_to_message_banner_message_id
to compose_banner.
2023-02-04 18:53:35 -08:00
evykassirer d9723a3dd4 compose tests: Move notifications out of mock_esm. 2023-02-04 18:53:35 -08:00
Ganesh Pawar b7335d0dec custom_emoji: Convert inline form to modal.
Fixes part of #21298.
2023-02-02 10:59:57 -08:00
Lauryn Menard e6bfdc7d34 settings: Create shared class for tooltips on disabled settings.
Creates a shared `disabled_setting_tooltip` class that can be
reused in cases where a personal or organization setting button
or input is disabled and a tooltip is added to give information
about why the user cannot change/access the setting.
2023-02-01 14:46:02 -08:00
Lauryn Menard d8b8b34ecd profile-settings: Change `name-input` class to a more specific id.
Changes `name-input` class, that was only being used in a div
wrapper for the input element for changing a user's full name,
to be a more specific id name: `full_name_input_container`.

This id is used to set or remove the disabled setting tooltip
when name changes are disabled by the organization.

There are no CSS rules set with this class/id.
2023-02-01 14:46:02 -08:00
Zixuan James Li b21f533af3 settings_users: Show all bots in organization settings.
We intended to show all the bots in the bots organization settings for
non-admin users as well. This switches from bot_data.all_user_ids() to
people.get_bot_ids() to get a full set of ids for all the bots in the
organization.

Because the source of data changes, "realm_user" instead of "realm_bot"
triggers the update of the bots list.

The code example (example4) is updated since we incorporate a side
effect into "realm_user"'s "add" op.

Note that while "realm_user" does not have a "delete" op, we still stop
redrawing bots on "relam_bot"'s "delete" op, because "delete" was only
triggered when the bot owner changes, the bot does not disappear from
the list of all bots.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-01-31 15:16:48 -08:00
Zixuan James Li 5ecd0cecf4 people: Implement get_bot_ids.
This provides a way to access all the bot users, no matter if they are
owned or admined by the current user or not.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-01-31 15:16:48 -08:00
Zixuan James Li c274865a3a node_tests: Remove unused get_args.
Added in 76ae8e23e2 probably as a typo, as
we usually further check the return value with an assertion.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-01-31 15:16:48 -08:00
David Rosa b79daa9fa3 gear menu: Drop special naming for organization settings menu item.
Removes the special naming of the organization settings gear menu
item for admins so that it lines up with how we refer to the
"Organization settings" UI itself in the help center documentation.
2023-01-26 10:17:45 -08:00
Aman Agrawal 37431cf0b5 urls: Provide `email` as a GET parameter.
Since we want to use `accounts/new/send_confirm` to know how many
users actually register after visiting the register page, we
added it to Google Tag Manager, but GTM tracks every user
registration separately due <email> in the URL
making it harder to track.

To solve this, we want to pass <email> as a GET parameter which
can be easily filtered inside GTM using a RegEx and all the
registrations can be tracked as one.
2023-01-24 11:29:50 -08:00
evykassirer 56c9b4f8c1 puppeteer: Check compose form contents in a new distinct function.
This is a prep commit for a future where we check the stream name
from a different field that isn't in the form, so that we only
have to change code in this single place.
2023-01-23 11:31:47 -08:00
N-Shar-ma aa72b51bca emojis: Prioritise custom / realm emojis when sorting.
Fixes: #18135.
2023-01-20 14:41:21 -08:00
N-Shar-ma 249f482b06 emojis: Filter out unicode emojis with same codes from typeahead menu.
Since emojis can have multiple aliases, an emoji was often suggested
under multiple names (like `smiling devil` / `smiling imp`), crowding
typeahead suggestions redundantly, and taking up the place of other
potentially relevant emoji suggestions.

Now such duplicates are removed post the sorting of suggested emojis,
and only the most relevantly named (highest sorted) copy is retained.
2023-01-20 14:41:21 -08:00
Sahil Batra ba1188db05 settings: Rename admin-realm-time-limit-input class.
This commit renames admin-realm-time-limit-input class to
time-limit-custom-input such that there is no confusion
when it is used for stream settings also.
2023-01-20 12:45:53 -08:00
Sahil Batra 565d133985 settings: Refactor code for waiting period setting.
This commit refactors code for realm waiting period setting
to be similar to other time-based inputs. We also add the
code to disable the save button when custom inputs have
invalid values.
2023-01-20 12:45:53 -08:00
Sahil Batra bc5f0e881e settings: Rename IDs of waiting-period-threshold setting elements. 2023-01-20 12:45:53 -08:00
Sahil Batra 43898be138 settings_org: Rename custom_days option to custom_period.
This commit renames custom_days option for realm waiting
threshold setting dropdown to custom_period such that we
can reuse existing code for similar time-limit settings.
2023-01-20 12:45:53 -08:00
Aman Agrawal a13058223d compose: Don't allow same message to be sent twice.
It is possible to send the message twice by clicking send button
very quickly twice or by pressing enter and send button simultaneously.

This can be easily reproduced for large messages sent in a stream
narrow. Hard to reproduce for small messages or in PM narrows.

I was not able to reproduce locally, but was able to reproduce on
chat.zulip.org. So, this is an untested bug fix.

Fixes #22562
2023-01-18 16:04:58 -08:00