Commit Graph

67 Commits

Author SHA1 Message Date
Sayam Samal 05c61037c8 dark_theme: Refactor and consolidate theme setting logic.
This commit centralizes the logic for setting a user's theme preference,
both for regular users and spectators, into the `dark_theme.ts` module.
This simplifies theme handling throughout the codebase and ensures that
the theme is set consistently across all modules.

Instead of relying on various call sites to update the recipient bar's
background color and switch between the light/dark realm logo after a
theme change, this commit modifies the `set_theme_and_update` function
to include these calls after every theme change. Before this commit,
some modules used to update the realm logo after a theme change, while
others did not. This led to inconsistencies in the UI depending on
which method was used to change the theme.
2024-06-27 16:24:49 -07:00
Karl Stolley 7dc20a56f2 info_density: Move timestamp calculations to better location. 2024-06-24 12:30:38 -07:00
Sahil Batra e19524ba92 settings: Use new group setting to private channels creation permission.
This commit updates webapp code to use new group based setting to check
permission for creating private streams.
2024-06-20 15:48:14 -07:00
Karl Stolley c80ffe8e0f server_dispatch: Calculate typography vars on dense_mode.
Owing to logic added in #30050, which accounts for the legacy line-
height value, toggling dense mode requires recalculating the
typography vars--otherwise, a non-legacy line-height value will
not be picked up until a refresh.
2024-06-18 10:08:54 -07:00
Sahil Batra a70eb21ea1 settings: Use page_params.is_spectator field for spectator checks.
Instead of current_user.user_id we use page_params.is_spectator
field to check the spectator cases as it makes it more clear
to the reader about what is the condition checking.
2024-06-14 17:11:23 -07:00
Sahil Batra f98a3fc684 settings: Use new group setting to check permission for creating public channels. 2024-06-10 12:24:45 -07:00
Mateusz Mandera 3ded4c2a7d presence: Frontend implementation of the last_update_id API.
Note: This involves adding presence info of unknown users to the
presence data.
With some small tweaks, we can just add the info to the presence data
structures, just making sure the buddy list correctly skips those
entries and that we redraw the user in the case where the user creation
event arrives after the presence polling loop.
2024-06-07 13:57:40 -07:00
Prakhar Pratyush 32391c3d06 ui_init: Don't store onboarding_steps state_data as current_user_param.
Earlier, onboarding_steps field of state_data was stored as
current_user_params.

Now, we store it separately in a data structure initialized in
onboarding_steps.ts

Reason: All the other state_data fields stored in current_user_params
are attributes of UserProfile. So, it makes sense to store it
separately.

Fixes part of #30043.
2024-06-03 08:53:28 -07:00
evykassirer 48fc0bc750 message_helper: Convert module to typescript. 2024-05-29 16:45:36 -07:00
evykassirer 7364c02ed6 message_helper: Set clean reactions when processing the raw message. 2024-05-29 16:45:36 -07:00
Prakhar Pratyush bf2360bcf2 onboarding_steps: Remove hotspot as an onboarding_step.
Earlier, hotspots and one-time notices were the valid
type of onboarding step.

Now, one-time notice is the only valid type.

Fixes #29296.
2024-05-10 12:30:22 -07:00
Karl Stolley 0cfd4c8eed settings: Hyphenate dense-mode classes. 2024-04-25 16:58:39 -07:00
Aman Agrawal 103c37f23a message_list: Don't always cache "Combined feed" view.
Important changes in this commit:
* We only cache message list for "Combined feed" if it is the
  default view.

* We modify existing handling of home message list code so that
  it can be used to for any message list that we want to cache
  using a new `preserve_rendered_state` variable.

* narrow_state.filter() returns the filter of combined feed view  list
  instead of `undefined`.

* We start fetching messages from the latest message on app load.

* Messages in all messages data and Recent view are always synced.

* If combined feed view list is not cached, we don't track it's
  last pointer, effectively sending user to the latest unread
  message always .
2024-04-25 09:20:43 -07:00
N-Shar-ma f39b57dd04 typeahead: Sort emojis by categories initially.
For more consistency between the emoji picker and the typeahead, now the
initial emoji list is ordered by categories for the typeahead too.

Tachnically, this means that `emoji_picker.rebuild_catalog` now updates
the typeahead's emoji data with category wise sorted emojis. Compose box
typeahead initialisation does not update the emoji data anymore.
2024-04-17 10:13:23 -07:00
roanster007 68b4298d8e settings: Add option to disable seeing typing notifications.
This commit adds an option to the advanced section of
Preferences settings, that would allow users to choose
whether to receive typing notifications from other
users.

Fixes #29642
2024-04-16 11:38:12 -07:00
Tim Abbott 3df46d542b Revert "message_reactions: Clean meassge reactions during initial processing."
This reverts commit c22a94dc89.

This broke live-update when adding new reactions.
2024-04-15 14:58:06 -07:00
Kenneth Rodrigues c22a94dc89 message_reactions: Clean meassge reactions during initial processing.
Clean reactions and set message_reactions in process_new_message.
Earlier, message_reactions was being set
after the predicate for the narrow was built,
as a result functions called while building the predicate
could not access it.
2024-04-12 12:42:54 -07:00
Karl Stolley 7291f0a919 info_density: Set font size, line height vars in dev. 2024-04-11 10:25:03 -07:00
Karl Stolley 6d5243148a timestamps: Calculate the maximum timestamp width in use.
Fixes: #26970
2024-04-03 17:38:43 -07:00
Vector73 f758ca596b custom_profile_fields: Add "required" parameter to the profile fields.
Fixes #28512.
2024-03-21 10:48:54 -07:00
shashank-23002 b74dabfaa4 alert_words: Highlight overlapping alert words more accurately.
This fixes a bug where alert words that are contained in another alert
word would have only the smaller alert word highlighted.

Note that it does not handle weirder cases, like "one two" and "two
three" being alert words; "two three" will always be highlighted, and
not "one"; this is probably fine in practice.

Fixes: #28415
Co-Authored-By: danieldotcomcoder <daniel_shdeed@hotmail.com>
2024-03-19 11:20:16 -07:00
Mateusz Mandera da9e4e6e54 backends: Implementation of restricting certain backends by plan.
Only affects zulipchat, by being based on the BILLING_ENABLED setting.

The restricted backends in this commit are
- AzureAD - restricted to Standard plan
- SAML - restricted to Plus plan, although it was already practically
  restricted due to requiring server-side configuration to be done by us

This restriction is placed upon **enabling** a backend - so
organizations that already have a backend enabled, will continue to be
able to use it. This allows us to make exceptions and enable a backend
for an org manually via the shell, and to grandfather organizations into
keeping the backend they have been relying on.
2024-03-05 11:48:58 -08:00
Prakhar Pratyush fe1a20ebb3 settings: Add realm-level setting 'zulip_update_announcements_stream'.
This commit adds a realm-level setting named
'zulip_update_announcements_stream' that configures the
stream to which zulip updates should be posted.

Fixes part of #28604.
2024-02-25 09:33:00 -08:00
Aman Agrawal f630272b4c message_lists: Set `current` to be `undefined` for non message view. 2024-02-24 08:31:18 -08:00
Prakhar Pratyush ee612dafac settings: Rename signup_notifications_stream realm setting.
This commit renames the realm-level setting
'signup_notifications_stream' to 'signup_announcements_stream'.

The new name reflects better what the setting does.
2024-02-21 09:04:23 -08:00
Prakhar Pratyush ab453fbe20 settings: Rename notifications_stream to new_stream_announce..._stream.
This commit renames the realm-level setting 'notifications_stream'
to 'new_stream_announcements_stream'.

The new name reflects better what the setting does.
2024-02-21 09:04:23 -08:00
Alex Vandiver fc41d6085b tornado: Split server restart events from web client reload events. 2024-02-15 15:42:50 -08:00
Anders Kaseorg b9e62c7af8 page_params: Split out state data for realm.
For spectators, the chunk of page_params that originates from
do_events_register isn’t assigned until ui_init.js.  That means the
TypeScript type of page_params is mostly a lie during module load
time: reading a parameter too early silently results in undefined
rather than the declared type, with unpredictable results later on.

We want to make such an early read into an immediate runtime error,
for both users and spectators consistently, and pave the way for
runtime validation of the page_params type.  As a second step, split
out the subset of fields that pertain to the entire realm.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg e96ede0ef6 page_params: Split out state data for current user.
For spectators, the chunk of page_params that originates from
do_events_register isn’t assigned until ui_init.js.  That means the
TypeScript type of page_params is mostly a lie during module load
time: reading a parameter too early silently results in undefined
rather than the declared type, with unpredictable results later on.

We want to make such an early read into an immediate runtime error,
for both users and spectators consistently, and pave the way for
runtime validation of the page_params type.  As a first step, split
out the subset of fields that pertain to the current user.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Aditya Kumar Kasaudhan 49a9954413 settings: Rename settings_display to settings_preferences.
This commit renames "settings_display.js" file to
"settings_preferences.js".

Fixes part of #26874.
2024-01-12 15:33:16 -08:00
Evy Kassirer 6e902defba
node tests: Use noop helper function pattern in test files.
Some files already were using `noop` in place of `() => {}`.
It's both clearer what it means and is easier to type.
This updates all test files to fully use `noop`, and
adds a shared import from the test lib file.
2023-12-14 14:51:33 -08:00
Sahil Batra fef833008f server_events_dispatch: Handle "realm_user/remove" event.
This commit adds code to handle "realm_user/remove" event which
is received when a guest loses access to a user.
2023-12-07 19:34:07 -08:00
Sahil Batra 3d181a8ee1 settings: Remove "User groups" panel from settings overlay.
The "User groups" panel is now removed from settings overlay
and we instead use new "#groups" UI.

This commit also makes some changes to tests to ensure coverage
for pill_typeahead.js which was previously done by
settings_user_group_legacy.test.js. We have still not got
complete coverage on user_pill.ts as we have removed
settings_user_group_legacy.test.js, but we just add the file
to EXEMPT_FILS list for now and will handle it in future.

Fixes #28012.
2023-12-07 06:35:38 -08:00
Prakhar Pratyush 83bd9955e3 events: Add 'onboarding_steps' event deprecating 'hotspots'.
Earlier, the event sent when an onboarding step (hotspot till now)
is marked as read generated an event with type='hotspots' and
'hotspots' named array in it.

This commit renames the type to 'onboarding_steps' and the array
to 'onboarding_steps' to reflect the fact that it'll also contain
data for elements other than hotspots.
2023-12-06 18:19:20 -08:00
Anders Kaseorg 06c2b89525 timerender: Use an explicit time zone for all rendering.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-28 16:54:00 -08:00
Sahil Batra bb15b2d708 users: Send "update" events when deactivating or reactivating users.
We now send "realm_user/update" (and "realm_bot/update" for bots)
events with "is_active" field when deactivating and reactivating
users, including bots.

We would want to use "remove" event for a user losing access
to another user for #10970, so it is better to use "update"
event for deactivation as we only update "is_active" field
in the user objects and the clients still have the data for
deactivated users.

Previously, we used to send "add" event for reactivation along
with complete user objects, but clients should have the data
for deactivated users as well, so an "update" event is enough
like we do when deactivating users.
2023-11-02 08:31:12 -07:00
Lalit Kumar Singh dcf45da09c ts: Migrate `user_status` module to TypeScript.
Also removed an defensive if check from `emoji.ts` since it is not
needed now that we have `emoji.ts` converted to TypeScript.
2023-10-30 11:10:47 -07:00
Sahil Batra c9fccf476a settings: Rename default_view and escape_navigates_to_default_view.
This commit renames default_view and escape_navigates_to_default_view
settings to web_home_view and web_escape_navigates_to_home_view in
database and API to match with our recent renaming of user facing
strings related to this.

We also rename the variables, functions, comments in code and class
names and IDs for elements related to this.
2023-10-26 11:00:12 -07:00
Aman Agrawal 2f33fad5df left_sidebar: Add popover to make different views default.
Fixes #27324
2023-10-24 16:16:56 -07:00
Aman Agrawal bc3d48616e gear_menu: Migrate to use tippy. 2023-10-20 12:36:39 -07:00
Joelute 2cbf65b1f2 scheduled_messages: Indicate scheduled messages in conversation views.
These changes adds a new scheduled message indicator in conversation views
which informs the user of the number of messages that are scheduled to be
sent to the current view.

Fixes: #25584.
2023-10-11 17:53:07 -07:00
Dinesh fccdc054a1 typing_notifications: Frontend work to display notifs for streams.
Display/hide "X is typing" notification
on receiving start/stop typing event for streams.

Co-authored-by: Prakhar Pratyush <prakhar841301@gmail.com>
2023-10-10 17:36:55 -07:00
Anders Kaseorg 5327bcc5ac user_group_settings_ui: Merge into user_group_edit.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-09 10:58:50 -07:00
Anders Kaseorg fcaf1fe7d5 notifications: Split out audible_notifications module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-06 16:22:40 -07:00
Anders Kaseorg d5064fc7b2 narrow: Extract narrow_title module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-05 16:26:45 -07:00
Anders Kaseorg 13d1241eed activity: Extract new activity_ui module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-05 08:27:30 -07:00
Anders Kaseorg 67f2bc030f ui_init: Move update_invite_user_option to sidebar_ui.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-02 17:37:56 -07:00
Lalit 0e73b5547c user_settings: Add new user setting to show/hide unread counts on streams.
Added a show_unread_counts personal user setting to the
Settings > Display settings > Advanced section which
lets user choose whether he/she wants to see unread messages
count on the left sidebar for streams.

This setting have three options,
"All Streams" - This will show unread messages count for all
streams.
"Unmuted Stream" - This will be default option and it will
only show unread messages count for unmuted streams.
"No Stream" - This option will not show unread messages count
on any stream.

Fixes #24149
2023-09-13 18:45:45 -07:00
Ujjawal Modi 9a96d19315 invites: Frontend changes for adding the new realm setting.
This commit does the changes in frontend required
for adding the new setting `Who can create multiuse invite link.`

Fixes #15159.
2023-09-07 14:21:01 -07:00
Ujjawal Modi 77c67464ba invites: Live update option to create new invitations.
Earlier option to create new invitations in right_sidebar,
gear_menu and invitations panel does not get live update
when the setting `who can invite others to realm` is changed.

This commit make changes to do live update.
2023-09-07 14:21:01 -07:00