Commit Graph

8624 Commits

Author SHA1 Message Date
Priyansh Garg da2bdec4ad compose: Collapse compose-box after sending message.
Previously, after sending a message from the full-sized compose-box,
the compose-box remained in expanded state covering the entire middle
part. Instead, it should return to the original state after the
message is sent.

There's a subtle race that would cause the "Scroll down to see your
message" compose notification to appear incorrectly, because the
full-size compose box occluded the entire message feed at the time the
message was locally echoed, even though it would no longer do so after
collapsing.

We address that by shrinking the compose box immediately before doing
a local echo, in addition to the primary code path in
`clear_compose_box`.  Care is taken to ensure that we avoid shrinking
the compose box when sending a message that cannot be locally echoed
and gets an error from the server.

Tested on my Ubuntu development environment, by sending empty message,
valid message and slash commands. The compose-box only shrunk on
sending valid messages.

Fixes part of #19353.
2021-09-28 11:36:51 -07:00
Aman Agrawal bed7c672ce stream_create: Allow web public stream creation. 2021-09-27 14:46:24 -07:00
Aman Agrawal 3f9a404fb4 stream_create: Use `switch` instead of multiple `else-if`.
This change was forced by our linter in the previous commit.
2021-09-27 14:46:24 -07:00
isakhagg 9d291c9d3f tooltip: Add "download" text to tooltips on files.
Fixed #19740.
2021-09-27 10:54:37 -07:00
Sahil Batra c233ee9935 settings: Migrate twenty_four_hour_time setting to RealmUserDefault.
This commit removes the existing default_twenty_four_hour_time field in
Realm table which was used to set the twenty_four_hour_time setting of
new user on joining and instead we now use the twenty_four_hour_time
field of RealmUserDefault table for the same.

With some tweaks by tabbott to clarify the documentation.
2021-09-23 10:44:42 -07:00
Anders Kaseorg f8c2e7c7b0 i18n: Fix @typescript-eslint/unbound-method.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Anders Kaseorg abee9258c6 js: Fix @typescript-eslint/restrict-template-expressions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Anders Kaseorg f7a7cfea62 js: Fix @typescript-eslint/restrict-plus-operands.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Anders Kaseorg af1e34b348 timerender: Use date-fns for absolute_time.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Anders Kaseorg a0f8cf2d6f blueslip: Use built-in date formatting.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Anders Kaseorg ba610440ab js: Fix @typescript-eslint/no-floating-promises.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 18:06:06 -07:00
Sahil Batra a44e7a1a60 settings: Pass a single object to settings_notifications functions.
We refactor the code for user notification settings and realm-level
defaults of notification settings to pass a single object consisting
of container element, settings object, url and for_realm_settings
bool variable, to the functions, instead of passing them as separate
variables.
2021-09-21 14:56:27 -07:00
Sahil Batra e43d469e9a settings: Pass a single object to settings_display functions.
We refactor the code for user display settings and realm-level
defaults of display settings to pass a single object consisting
of container element, settings object, url and for_realm_settings
bool variable, to the functions, instead of passing them as
separate variables.
2021-09-21 14:56:27 -07:00
Sahil Batra 145e020af8 settings: Add live update code for user presence-enabled setting. 2021-09-21 14:56:27 -07:00
Sahil Batra ba1fe77996 settings: Add UI for realm-level default of enter_sends settings. 2021-09-21 14:56:25 -07:00
Sahil Batra 22ec3c7993 settings: Add UI for realm-level default of presence-enabled setting. 2021-09-21 14:39:13 -07:00
Sahil Batra 28b20e4440 settings: Use id of the container to find status element.
This commit changes the code to use container id in the
selector of the status element of presence_enabled setting
such that the correct element is selected because we will
add another element with same class in the realm-level
presence_enabled setting.
2021-09-21 14:39:13 -07:00
Aman Agrawal 8c50a08066 stream_edit: Live update UI when a stream becomes web public. 2021-09-21 10:22:33 -07:00
Aman Agrawal ab63bb638a popovers: Hide most irrelevant options for spectators.
This simplifies the UI for these popovers to not have tons of options
that cannot be accessed.
2021-09-21 10:10:54 -07:00
Aman Agrawal c6db2a330b stream_edit: Use `switch` instead of multiple `else-if`.
This is a prep-commit which simplifies changes when we add
web public streams condition here. Since our linter forces us
use switch then, we use it beforehand to simplify changes.
2021-09-21 10:05:30 -07:00
Anders Kaseorg 7f9e5e2aad favicon: Fix embedded number font for Webpack 5 asset modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-16 17:20:30 -07:00
Tim Abbott 26d9854a5a settings: Deduplicate notification settings labels. 2021-09-16 16:07:32 -07:00
Sahil Batra 1682ec46dd settings: Add live update code for realm-default notification settings. 2021-09-16 15:46:41 -07:00
Sahil Batra d4c8284d24 settings: Add UI for realm-level defaults of notification settings.
This commit adds UI for realm-level defaults of user notification
settings. We do not have "Send test notification" option here.
2021-09-16 15:46:41 -07:00
Sahil Batra 8b9b0638c6 settings_config: Pass settings object as parameter to all_notifications.
We pass user_settings object to all_notifications and
get_notifications_table_row_data such that we can use these
functions for realm-level settings also.
2021-09-16 15:46:41 -07:00
Sahil Batra de1aa25059 notifications: Refactor update_notification_sound_source.
The container element and settings object are passed as
parameters to update_notification_sound_source. This change
is done so that we can use the same function for updating
the realm-level notification sound source.
2021-09-16 15:46:41 -07:00
Sahil Batra 079e45c7cf settings: Use variable for notification sound element.
This commit changes the click handler for playing
notification sound to use a variable instead of
directly using the element id such that we can
use the same code for realm-level settings also
by just setting the variable accordingly.
2021-09-16 15:46:41 -07:00
Sahil Batra 1252d1602b settings: Refactor notification settings frontend code.
This commit creates a new module user_notification_settings.js
for user-level notification settings and the settings_notification.js
will be used as a common module for both user-level and realm-level
settings.
We also add parameters to the functions in settings_notifications.js
to pass container elem and settings object for the same purpose.
2021-09-16 15:46:41 -07:00
Sahil Batra 791d09ccd0 settings: Use form element in handler for notification settings.
Notification settings uses '.on("change", "input, select")' to
handle changes to all types of input elements. But for realm-level
settings page, both display and notification settings have the
same container unlike the user-level settings, so we use inner
form element ".notification-settings-form" such that this handler
is for changing input of notification settings and not display
settings.
2021-09-16 15:46:41 -07:00
Sahil Batra 9551551b00 settings: Use settings_object variable instead of user_settings.
We set settings_object variable to user_settings object and then
use settings_object everywhere. This change will help us in using
the same code for realm-level settings also by setting the
appropriate value for settings_object.
2021-09-16 15:46:41 -07:00
Sahil Batra ebab2a89fb settings: Refactor change_notification_setting to have url parameter.
We refactor the change_notification_setting function to have a url
parameter instead of directly using "/json/settings" directly.

This change will help us in using the same code for realm-level
settings also.
2021-09-16 15:46:41 -07:00
Sahil Batra 44c820da3a settings: Fix live update code of notification settings.
We add code for live updating notification batching period
setting. This commit also adds 'continue' statement in the
else-if condition of update_page function such that we do
not execute the code of checkbox settings for notification
sound and email batching period settings.

We also update the other_notification_settings list in
settings_config.ts to remove email_notifications_batching_period
and instead have email_notifications_batching_period_seconds
which is the correct name of setting used in backend and in
the events sent to the clients such that the live-update is
done correctly.
2021-09-16 15:46:41 -07:00
Sahil Batra 90e4740455 settings: Use class instead of id for email batching period setting.
This commit removes the id from email notification batching period
setting dropdown and adds class such that we can use same template
for the realm-level settings as well. We also add 'setting_'
prefix as we do for other settings and modify the JS code accordingly.
2021-09-16 15:46:41 -07:00
Sahil Batra 67d534869c settings: Use container variable for accessing top-level element.
This change was missed in 032d347b4f.
2021-09-16 15:46:40 -07:00
Sahil Batra 1b530e74d2 settings: Disable realm-level defaults of user settings for non-admins. 2021-09-16 15:46:40 -07:00
Sahil Batra 3242a61894 user_groups: Hide system user groups from UI.
We do not have any system user groups as of
now, but this commit is just a prep commit
to prevent any change in user-facing pages
to avoid confusion till this feature is
completed.

This change was initially made in 6117c38,
but it was reverted in 1543775a due to merge
conflicts with the typescript migration of
user_groups.js.
2021-09-16 13:11:03 -07:00
Priyank Patel 397821660f ts: Convert sub_store module to TypeScript.
We also upgrade @babel/preset-typescript to the latest version to
get support for constant enums.
2021-09-15 17:19:39 -07:00
Priyank Patel 0d91472c64 ts: Convert timerender module to TypeScript. 2021-09-15 17:19:39 -07:00
Tim Abbott 1543775ac6 user_groups: Temporarily remove is_system_group check.
This effectively reverts 6117c3824a,
which merge conflicted with the typescript migration on this file, and
this commit is easier to undo.
2021-09-15 17:19:21 -07:00
Priyank Patel 9de3b2f4fd ts: Convert user_groups module to TypeScript. 2021-09-15 16:53:17 -07:00
Priyank Patel 3e6141d03f user_groups: Remove suppress_errors support for get_user_group_from_id. 2021-09-15 16:52:35 -07:00
Tim Abbott 9c623a1b3e settings: Add periods to end of bot permissions strings.
This improves consistency with how all of our other settings tip
elements are written.
2021-09-15 09:59:20 -07:00
Sahil Batra 06f46cc146 settings: Add live update code for realm-level defaults settings.
This commit adds code for live-updating the realm-level default
settings page which contains only display settings as of now.

This commit also adds realm_user_settings_defaults object to
zpage_params so that we can write the tests.
2021-09-15 09:56:33 -07:00
Sahil Batra 96d6bf28db settings: Add UI for realm-level defaults of display settings.
This commit adds a new module settings_defaults.js which calls
the functions in settings_display passing appropriate container
element and settings object as parameters.
We also add one more parameter for_realm_settings to some of the
functions in settings_dislay to differentiate between the user
and realm-level settings.
2021-09-15 09:56:32 -07:00
Sahil Batra a440c93030 settings: Add realm_user_settings_defaults module. 2021-09-15 09:50:31 -07:00
Sahil Batra 6bae097bf1 settings: Refactor settings_display.js code.
This commit refactors the code in settings_display.js
by modifying the functions to receive the container
element and settings object as parameter such that
we can use the same functions for realm-level
settings by passing appropriate container element
and settings object.

This change is needed as settings_display will be
used as a common module for user settings and realm
level settings.

We also rename the default_language_name variable in
settings_display to user_default_language_name as we
would add a separate variable for realm-level setting
in future.
2021-09-15 09:50:31 -07:00
Sahil Batra e127cde3c1 settings: Make separate object for display settings labels.
This object will also be used for labels of realm-level
default of display settings.
2021-09-15 09:50:31 -07:00
Sahil Batra 6e169be933 settings: Fix the sticky behavior of saving indicator.
We want the saving indicator to be sticky in the cases
where we ask user to reload after changing settings.
This used to work correctly before 9e08c6db93, as
'if(remove_after)' returned false if remove_after was
null, but the condition was changed in 9e08c6db93
to 'if(remove_after !== undefined)' and thus the
condition returned true when remove_after was null.
This commit change the remove_after value to undefined
for sticky cases.
2021-09-15 09:47:08 -07:00
Tim Abbott e7c62c4190 stream_data: Rephrase descriptions of stream permissons.
The previous phrasing used incorrect terminology (E.g. "stream
members", not "stream subscribers", which is really confusing given
that we have a "member" role which is also relevant in this text).
2021-09-14 11:29:32 -07:00
Aman Agrawal 7c8e19758a stream_data: Add web_public as a stream privacy mode.
Show web_public descriptions for web public streams.

(Temporarily limited to development environments, since this feature
is not available yet).
2021-09-14 11:12:47 -07:00