Commit Graph

4437 Commits

Author SHA1 Message Date
Sahil Batra fef825d56f settings: Rename class of notification settings elements.
We rename class of notification settings except checkboxes
by prefixing them with 'setting_' for clarity.

We do not change class of checkboxes because settings_checkbox
is used by other templates also and if we only change class
of those using notification_settings_checkboxes then live
update code will break and will need to add separate condition
for differentiating between which partial template is used.
2021-08-20 07:51:23 -07:00
Sahil Batra d05730a199 settings: Rename classes for display settings elements.
We rename the class of display setting elements by prefixing
them with 'setting_' for clarity.
2021-08-20 07:51:11 -07:00
Sahil Batra 032d347b4f settings: Refactor frontend code for notification settings.
This is a prep commit for adding UI for realm-level default
of user settings. We refactor the code to use  classes
instead of ids such that we can use the common code for the
new settings.
2021-08-20 07:50:51 -07:00
Sahil Batra c5cc4fb114 settings: Refactor default-language modal code.
We add a prefix to id of default_language_modal.hbs
such that we can use the same code for user settings
and realm-level settings.
We also add a class "default_language_modal" to the
modal div to avoid duplicate css.
2021-08-20 07:50:51 -07:00
Sahil Batra 3adf5e6383 settings: Refactor frontend code for display settings.
This is a prep commit for adding UI for realm-level
default of user settings. We refactor the code to use
classes instead of ids such that we can use the common
code for the new settings.
2021-08-20 07:40:20 -07:00
Sahil Batra 5f5c88a4e2 user_groups: Add 'is_system_group' field to objects passed to clients. 2021-08-19 02:56:43 -07:00
Anders Kaseorg 2bfe8d5c90 node_tests: Fix incorrect usage of assert.throws.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-10 13:18:53 -07:00
Steve Howell ea6929457c unread: Add get_read_message_ids() helper.
We only use this is in tests for now, but it will be
helpful to mark messages as unread in an upcoming PR.
2021-08-04 12:06:11 -07:00
Steve Howell 1901e980c9 node tests: Test direct mentions.
This never got tested despite 100% line coverage, due to
a boolean expression.
2021-08-04 12:06:11 -07:00
Riken Shah e5b216fc64 compose: Update status text in placeholder instantly after it's updated.
When compose box is opened to self and the user
updates the status, it should instantly update the status
text in a placeholder.
2021-08-04 01:11:06 -07:00
Riken Shah 49193231aa puppeteer_test: Improve how we select the typeahead element.
Our typeahead system is very sensitive, a simple internal
focus can hide it. This leads to occasional failure on the
puppeteer test.

This commit tries to solve it by clicking via javascript
instead of manual puppeteer click.
2021-08-01 23:20:13 -07:00
Sahil Batra 998d710275 frontend: Add new user_settings module for user's settings.
We add a new user_settings module similar to page_params
module in frontend and use it to access user's personal
settings instead of page_params.
2021-08-01 15:30:17 -07:00
Sahil Batra ea44b6bcc1 events: Use user_settings event in frontend live-update code.
We now use the newly added "user_settings" event in the frontend
code instead of previous "update_global_notifications" and
"update_display_settings" events which are now depreceated.
2021-08-01 15:30:17 -07:00
Gaurav Pandey d89b4dcd0b api: Return zulip_merge_base alongside zulip_version.
Return zulip_merge_base alongside zulip_version
in `/register`, `/event` and `/server_settings`
endpoint so that the value can be used by other
clients.
2021-07-30 12:03:41 -07:00
Riken Shah 4d3b10d84d puppeteer: Fix the element becoming stale.
As the right sidebar re-renders many times, often the
element puppeteer selected becomes stale, to avoid this
issue we are using javascript to click on the element.

This commit also ensures that the set user status modal
is completely open before we start clicking.
2021-07-30 09:19:56 -07:00
Tim Abbott 399dc5046b Revert "narrow: Do not mark messages as read in mentioned narrow."
This reverts commit 5e97ec9ad9.

This change has been pretty confusing for users, and so we need to do
something more in order to make the UI acceptable to change this
default.
2021-07-29 17:31:51 -07:00
Priyam Seth 3ce7a9dd08 compose: Move warn functions from compose.js to compose_validate.js.
This commit moves the warn_if_private_stream_is_linked,
needs_subscribe_warning, and warn_if_mentioning_unsubscribed_user
to compose_validate.js from compose.js.

These warning functions are very naturally part of the compose box
validation system, though they're a bit different in being called from
the typeahead codebase.

Part of splitting compose.js into more natural modules.
2021-07-29 15:22:31 -07:00
Priyank Patel 6b93fe0cd7 ts: Convert settings_config module to TypeScript. 2021-07-29 11:30:18 -07:00
aryanshridhar 94b872828b MDLW: Render tippy tooltip once the selected items surpasses the limit.
This commit enhances our Multiselect dropdown list widget by
displaying a tippy tooltip over the dropdown button once it's
text changes to `n selected` where n is the number of items
selected by user which exceeds the limit passed.

It essentially helps the user to identify the dropdown items they
have selected by just hovering over the dropdown toggle button.
2021-07-29 10:09:03 -07:00
aryanshridhar 7c588d4747 dropdown_list_widget: Add support for Multiselect dropdown list widget (MDLW).
This commit adds the support to select multiple dropdown items by inheriting
dropdown list widget and overriding some of it's properties.

The parameters that can be passed along with it are-

- widget_name: The desired name of the widget.
- data: The data that needs to be populated as dropdown items.
- default_text: The default text to be rendered when none of the items is selected.
- on_update: Function to trigger once the filter button is pressed.
- on_close: Function to trigger once the dropdown is successfully closed after filtering.
- value: The default value that is initially selected by user.
- limit: The maximum number of dropdown items to display on button text.

This widget can later be implemented in recent topic view to replace the
several ellipses filter button and also within the organisation user's page
to quickly sort the users list according to their org role.
2021-07-29 10:09:03 -07:00
aryanshridhar 5c2bafc6b0 dropdown_list_widget: Refactor dropdown_list_widget to constructor function.
This is a prep commit for adding the support of Multiselect
dropdown list widget by prototypal inheritance.

The following change actually revamps the dropdown list widget
into a constructor function, due to which the widget is now to
be initialized with the `new` keyword (which adds a property
to __proto__ object that links to the constructor function's
prototype object).

Example-
const foo = new DropdownListWidget({....});

Due to the above change, this commit also modifies the declaration
of dropdown_list_widget across all our instances.
2021-07-29 10:09:03 -07:00
Priyank Patel c37cde1202 util: Make less function required for lower_bound. 2021-07-28 17:32:09 -07:00
Priyam Seth 3ec55e7976 compose: Move keydown and keyup from compose.js to compose_ui.js.
This commit moves the handle_keydown and handle_keydown functions
of compose.js to compose_ui.js.

Part of splitting compose.js.
2021-07-28 14:01:40 -07:00
Riken Shah 6eb88eb3ef puppeteer: Use a better approach to open user popover.
This commit improves the approach to click on the menu
icon on the right sidebar. It'd first hover on the list
instead of the menu to avoid the occasional "HTML node
not present" error. As menu icon our only visible when
we hover over the item.
2021-07-28 12:07:48 -07:00
Riken Shah 4eeb6be787 user_status: Add default emoji for common statuses.
Co-authored-by: Yash Rathore <33805964+YashRE42@users.noreply.github.com>
2021-07-28 10:02:51 -07:00
Riken Shah cea961b129 user_info_popover: Show status emoji.
In this commit,

* We show status emoji alongside status text in the user
info popover.

* Updated clear status button to also clear status emoji.
2021-07-28 10:02:51 -07:00
Riken Shah 840ab92f7f user_status: Add architecture to support status emoji feature.
In this commit, we only update the existing architecture
to support the status emoji feature:

* We add the `user_status_emoji_info` map so we can
keep track of the users' staus emoji.

* Listen to the server event to update/set the
`user_status_emoji_info` map.

* Add `status_emoji_info` field, when getting user's data.
2021-07-28 09:50:11 -07:00
Riken Shah 6c003a7802 refactor: Move emoji details related code to `emoji.js`.
As `reaction.js` and `user_status.js` has similar code to
get emoji details, it makes more sense to extract this as a
single function.
2021-07-28 09:35:00 -07:00
sahil839 b8854a9d92 settings: Add full members and moderators options in custom emoji setting. 2021-07-27 16:41:23 -07:00
sahil839 4b1313a92b models: Replace add_emoji_by_admins_only with add_custom_emoji_policy.
This commit replaces boolean field add_emoji_by_admins_only with an
integer field add_custom_emoji_policy as we would also add full members
and moderators option for this setting in further commits.
2021-07-27 16:41:22 -07:00
M@ 53540432e1
compose: Fix typos in error message for too-long compose content. 2021-07-27 16:03:19 -07:00
Sahil Batra 355f6e9b53 settings: Move 'enter_sends' setting to property_types dict.
This commit moves "enter_sends" setting to property_types dict.
With this change, changing enter_sends setting also sends an
event of type "update_display_settings" and thus enables us
to live-update the UI.
2021-07-27 15:52:53 -07:00
Sahil Batra dafd32bd09 compose: Extract compose.toggle_entry_sends_ui function.
This commit extracts the code for hiding and showing the
send button according to 'enter_sends' setting value in
a separate function.
2021-07-27 15:52:53 -07:00
sahil839 ca0bb5b9d8 settings: Add nobody option for invite_to_realm_policy in frontend. 2021-07-26 17:48:01 -07:00
Ganesh Pawar 43a3a73a0d widgets: Avoid adding the widget_elem if it already exists.
Fixes #18631
2021-07-24 09:52:14 -07:00
Tim Abbott 61a9229dba user_status: Fix test import order to pass lint. 2021-07-23 13:25:39 -07:00
Riken Shah 67f4851ded user_status: Add `get_emoji_info` function.
This is a prep commit to add the status emoji feature.

This function will add missing/extra parameters to the
emoji info object, that would need by the template to
render an emoji.

Co-authored-by: Yash Rathore <33805964+YashRE42@users.noreply.github.com>
2021-07-23 13:03:32 -07:00
PIG208 60e3429da3 bots: Remove the need to debounce for dispatching bot events.
We rely on calling eventually_render_bots from the event handling
code path for bot events to both updating the list and switching
the tab.

Now we decouple the logic and make render_bots take care of
rendering the list of bots only and switch the tab upon calling
the success handler of creating the bot.

Fixes: zulip#17743
2021-07-23 11:26:42 -07:00
Tim Abbott 99e6618f07 compose: Fix validation treating welcome bot as deactivated. 2021-07-22 15:22:20 -07:00
Priyansh Garg c541699b9b compose: Fix expanded compose un-collapsible in presence of navbar_alerts.
The distance of compose-box from the top is hardcoded in the existing
code as `50px`, which only considers the height of the `.header`, plus the
padding-bottom of the header. This results in a bug where the top bar of
compose-box gets hidden behind the header if navbar_alerts is also present
in the view.

This commit calculates the top distance of the compose-box dynamically,
whenever the compose-box is opened and set the `top` property of the
compose-box accordingly.

Tested on my Ubuntu development environment.

Fixes: #19249.
2021-07-22 14:25:48 -07:00
Abhijeet Prasad Bodas d0b3801596 ui_init: Fix "Error: Unknown user_id in get_by_user_id: 0".
For spectators (logged view), we send user_id=0 via page_params.

The people module does not know about this user ID, and so throws the
exception. Earlier `people.get_by_user_id` was not called on page load,
but only when determining settings permissions with `settings_data.user_has_permission`.

But 231c536cad made it so that that function
is always called, so we need to handle the spectator case explicitly.

Co-authored-by: Gaurav Pandey <gauravguitarrocks@gmail.com>
2021-07-22 14:06:13 -07:00
Sahil Batra 318d71469b api: Remove '/users/me/enter-sends' endpoint.
We remove the '/users/me/enter-sends' endpoint
and 'enter_sends' setting will now be edited
using the '/settings' endpoint.
2021-07-22 11:01:43 -07:00
Dinesh 74206acbfd node_tests: Add a mock_template example test. 2021-07-22 09:47:47 -04:00
Dinesh 54daeadbd6 node_tests: Replace `set_global` with `mock_esm` in example4.js.
We dont use set_global in any of those examples. mock_esm is
a better replacement for that in the comment.

Also fixed a typo in example3.js.
2021-07-22 09:47:47 -04:00
Vishnu KS 199d3859fb billing: Make create_ajax_request accept callback function.
This is a prep commit for the Stripe checkout migration.

create_ajax_request function used to create an ajax request to our
billing API and on completion redirect to one of the URLs in our
website. The stripe migration requires the ajax request function to
execute Stripe javascript code post the request completion to redirect
to Stripe checkout page. So this commit updates the function to accept a
callback function which gets executed post the request completion.
2021-07-20 14:43:38 -07:00
Priyank Patel 231c536cad settings_data: Break circular dependency with people. 2021-07-20 14:28:48 -07:00
Alya Abbott 89724e5bb4 billing: Edit helper text on sponsorship application
* nonprofit -> non-profit
* Edit pass on defautl helper text to use more user-oriented language.
2021-07-19 17:26:45 -07:00
m-e-l-u-h-a-n b23fd2f1f3 stream settings: Move subscription_result template to stream_settings.
This commit moves stream_subscription_request_result.hbs to
stream_settings folder to have a consistent file structure
for stream setting templates.
2021-07-19 10:54:11 -07:00
m-e-l-u-h-a-n 70aa957e55 stream settings: Move stream list templates to stream_settings.
We move templates related to listing streams in left pannel of
stream settings overlay to stream_settings folder by making
following changes:

* Rename `subscriptions.hbs` to `browse_streams_list.hbs`.
* Move `settings_stream_list.hbs` to stream_settings folder.
* Rename `subscription.hbs` to `browse_streams_list_item.hbs`.
* Move `settings_stream_list_item.hbs` to stream_settings folder.
2021-07-19 10:54:11 -07:00
sahil839 0594207180 realm_logo: Rename realm_logo.rerender to realm_logo.render.
As realm_logo.rerender is now used for initial rendering of
logo as well in c8849f8, so we rename this function from
rerender to render.
2021-07-19 09:45:29 -07:00