Commit Graph

13215 Commits

Author SHA1 Message Date
Aman Agrawal c23f5a114e topic_list: Don't restore focus to search if it wasn't focused.
After topic list is updated, only restore focus to it, if it was
focused before. This avoids jumping focus from say compose box
to topic search unexpectedly when the topic list is updated.
2022-01-07 14:39:16 -08:00
Anders Kaseorg 03f073d762 compose: Fix Enter to send switch internationalization.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-07 14:38:10 -08:00
Priyam Seth 9aa5082d63 message edit: Move with_first_message_id to message edit.js.
Prep commit so that the function first_message_id can be used
as an exported function for marking resolved topic as unresolved.

Related to #20584.
2022-01-05 17:55:00 -08:00
Aman Agrawal b3886af651 click_handler: Use a variable for target's jquery instance. 2022-01-05 16:15:40 -08:00
Aman Agrawal bf7224d04d reminder: Simplify logic and improve error text. 2022-01-05 16:15:40 -08:00
Aman Agrawal fa4311e7d0 popovers: Don't trigger remind handler on every flatpickr confirm.
This is part of remind popover and hence should be handled
separately.
2022-01-05 16:15:40 -08:00
Aman Agrawal 4d7cbc0a63 compose: Move emoji button outside of popover.
Since we more space after moving Help button below, we stop hiding
emoji icon in a popover on small screens.
2022-01-05 16:03:53 -08:00
Aman Agrawal e4b8b9a24e compose: Move `Help` icon beside `Enter send` button. 2022-01-05 16:03:53 -08:00
Aman Agrawal db09639f6c compose: Change UI which toggles `enter_sends` setting.
Use a popover which displays both the options instead of long text.
We only use a small text indicating the current state which user
can click on to trigger the popover.
2022-01-05 16:03:53 -08:00
Rishabh Maheshwari 937d49e209
popover: Fix alignment of edit and delete button.
The icons were misaligned with the time stamp.  

I changed the CSS `right` property to get proper alignment.

Fixes: #20529.
2022-01-05 15:24:00 -08:00
Eeshan Garg 7196b5ac84 header: Fix unresponsive dropdown pill on /help pages.
My PR #18974 introduced a bug where the logged-in dropdown pill on
the /help pages stopped working and has been unresponsive ever
since. This was caused by the incorrect assumption that each
`.dropdown` would be inside an unordered list `ul`. However, that
isn't the case for the dropdown pill on the /help pages. This commit
simply removes said assumption, by widening the scope of the relevant
CSS selectors.
2022-01-05 15:18:24 -08:00
Sahil Batra 98ec1acb35 settings: Make banner asking to confirm new email sticky.
We make the banner, mentioning the user to confirm new email
after changing the email through settings, sticky and it
disappears either on reload or after confirming the new email.

Fixes #20686.
2022-01-05 14:42:23 -08:00
YashRE42 e17c96d86d composebox_typeahead: Fix bug in global time backspace & delete cases.
In the previous commit (bea41e975d) we
introduced a bug by using `hotkey` instead of `hotkey.name`, further
debugging revealed that the conditional was unnecessary and as such
has been removed in this commit, the comment for the is_numeric
conditional has also been changed to explain its actual purpose.

Some other inline comments have also been moved to be on their own
lines.
2022-01-04 18:10:21 -08:00
YashRE42 bea41e975d compose: Fix numeric typing regression related to global time widget.
In commit 1d54b383bd we introduced some
changes to add better support for keyboard navigation with the global
time widget. Unfortunately, as a result of the fact that
get_keydown_hotkey returns undefined for numeric keys, we caused a
regression that prevented users from typing into the time picker.
Additionally, we also lost support for the backspace and delete keys.

Hence, this commit fixes the above bug by early returning in two
places if the key pressed is backspace, or delete or a numeric key.
2022-01-04 17:06:47 -08:00
Sahil Batra b642615e73 settings: Rephrase text in user deactivation modal. 2022-01-04 14:42:19 -08:00
Sahil Batra 2eb1f0195d settings: Show only real email in user deactivation modal.
We show email of the user being deactivated only if real email is
accessible and not the fake email generated using user id.
2022-01-04 14:42:19 -08:00
YashRE42 d82653c3de condense: Do not cache message_content height of 0 from recent_topics.
Previously, we suffered a bug where we would not properly condense
messages on first load of CZO (ie after login).

This bug was an unintended consequence of setting recent topics as the
default view, because since the page loads to recent_topics the
message_list is hidden but still gets rendered into the DOM and when
condense_and_collapse runs, it causes get_message_height to cache a
message height of 0, which results in the message not being collapsed.
There may be other ways to trigger the same broken mechanism.

This commit changes the function so we only return 0 but don't cache
the result.

Fixes: #20666.
2022-01-02 12:12:36 -08:00
Steve Howell c6d9029dfc dom: Remove outer subscriptions div. 2021-12-30 11:36:52 -08:00
Steve Howell 7ff89e4cae dom: Rename div to #manage_streams_container.
The old name was confusing, since the contents
of the div aren't just a table, and we have
smaller elements that actually do list a bunch
of subscriptions in tabular format.
2021-12-30 11:36:52 -08:00
Steve Howell 507da749b7 stream edit: Tighten up selectors for handlers.
Even though we intend to shortly share lots of code
for editing stream subscribers with the create-stream
UI, we don't want to confuse click handlers and
containers too much.
2021-12-30 11:36:52 -08:00
Steve Howell 36378477ff stream edit: Extract make_list_widget. 2021-12-30 11:36:52 -08:00
Steve Howell f55d9c2f35 stream edit: Simplify how we find the search input. 2021-12-30 11:36:52 -08:00
Steve Howell 5e86c72f8e stream edit: Extract set_up_pill_typeahead. 2021-12-30 11:36:52 -08:00
Steve Howell 5a89672ac5 refactor: Extract update_subscribers_list_widget. 2021-12-30 11:36:52 -08:00
Steve Howell fb003d757b performance: Use a single ListWidget for subscribers.
It's kind of silly to cache ListWidgets for subscriber
lists when we only ever update the most recent one.

This will save memory if you are managing a whole bunch
of streams, although I suspect the savings here is
mostly negligible unless you were doing something
crazy.

The main motivation here is just that it simplifies the
code.
2021-12-30 11:36:52 -08:00
Steve Howell afd1d12405 refactor: Remove is_sub_settings_active. 2021-12-30 11:36:52 -08:00
Steve Howell 2a19468432 subscribers: Use current_stream_id to track current stream. 2021-12-30 11:36:52 -08:00
Steve Howell 1c54d44f97 hash_util: Add is_editing_stream helper.
This is a bit more robust than active_stream().

We don't do the typeof check for parseFloat,
since even NaN is a number type.
2021-12-30 11:36:52 -08:00
Steve Howell 208cec2848 refactor: Move update_subscribers_list.
We should be able to solve the import back
to stream_edit in an upcoming commit.
2021-12-30 11:36:52 -08:00
Steve Howell 49a1d5a9a3 refactor: Reduce scope of message var. 2021-12-30 11:36:52 -08:00
Steve Howell d7f90acbf6 refactor: Extract remove_subscriber. 2021-12-30 11:36:52 -08:00
Steve Howell e742ebb8e8 refactor: Limit scope of e.target.
Now our click handlers get stream_id directly from
e.target, and then downstream code is no longer
coupled to the event semantics.

Note that we'll probably just know the stream_id
more directly after future commits.

We also remove a little bit of redundant error
handling.
2021-12-30 11:36:52 -08:00
Steve Howell 0777cd73bb stream edit: Extract stream_subscribers_ui.js.
This is a fairly straightforward extraction.

It's good to test this with Iago, and then go into
Manage Streams and add/remove subscribers for a stream
like devel.

I copy/pasted two small functions that will soon
diverge from stream_edit. The get_stream_id function
will either use a module variable (since we're
generally only editing subscribers for one stream, and
we already have the singleton assumption with
`input_pill`) or a more strict CSS selector.  And then
get_sub_for_target depends on get_stream_id. We may not
always need full subs, anyway, and when we adapt some
of this code for creating streams, things are likely to
change.

I stopped exporting a couple functions that have no
callers outside of this module.

The main entry point for the module is
enable_subscriber_management.

We continue to export invite_user_to_stream and
remove_user_from_stream, which should possibly be just
pulled into their own module to lessen some
dependencies, but they don't have too much baggage,
since they just wrap channel calls.
2021-12-30 11:36:52 -08:00
Steve Howell d938f73d05 refactor: Move code for can't-subscribe popover. 2021-12-30 11:36:52 -08:00
Biki-das b3c2f88b7b typeahead: Remove unnecessary topic_names variable.
Also fix a comment typo in the same file.
2021-12-30 06:56:29 -08:00
Tim Abbott 877c275380 typeahead: Use early return pattern for enter logic.
This makes this code more readable.
2021-12-30 06:55:57 -08:00
Julia Bichler b673e966ca spectators: Prevent toggling TODO checkboxes.
Checkboxes now don't change if a user who is not logged in
clicks on them.

Fixes #20300.
2021-12-29 17:10:21 -08:00
Sahil Batra a59d429045 settings: Fix code for special case of theme settings subsection.
We handle "Theme settings" subsection separately in
get_subsection_property_elements as it contains unique
radio-button structure for emojiset setting.

This should have been fixed while reorganizing the section
to have color scheme and emoji related settings under same
subsection in adb612a0b4.

Fixes #20644.
2021-12-29 16:32:12 -08:00
YashRE42 5e194afda3 reactions: Destructure during make..reaction call from set..reaction.
This is a pure code refactor for readability.
2021-12-28 11:12:02 -08:00
YashRE42 6fa92cce7e reactions: Use parameter destructuring in make_clean_reactions.
This is a pure code refactor for readability.
2021-12-28 11:11:57 -08:00
YashRE42 06d8e6dfd5 reactions: Refactor add_clean_reactions to make_clear_reaction.
This is a pure code refactor for readability.

Previously, we were relying on there being a side effect to
add_clean_reaction which was necessitated by the presence of an output
parameter, `message` (or more specifically `message.clean_reaction`).
Output parameters are confusing.
Hence, this commit changes to have a make_clean_reaction function that
returns a reaction.
2021-12-28 11:11:51 -08:00
YashRE42 0b0637de78 reactions: Remove `export` from add_clean_reaction() function.
This function is not called by any external files or tests.
2021-12-28 11:11:43 -08:00
YashRE42 1dffad98fa reactions: Use parameter destructuring in insert_new_reaction.
This is a pure code refactor for readability.
2021-12-28 11:11:39 -08:00
YashRE42 0438ed5777 reactions: Use parameter destructuring in update_existing_reaction.
This is a pure code refactor for readability.
2021-12-28 11:11:37 -08:00
YashRE42 0991ed4526 reactions: Use parameter destructuring in view.remove_reaction.
This is a pure code refactor for readability.
2021-12-28 11:11:31 -08:00
BIKI DAS 42dd58cffe
docs: Fix a few typos in documentation. 2021-12-28 09:36:59 -08:00
BIKI DAS d7f5d041b9
typo: Rename default_hander to default_handler. 2021-12-28 09:19:57 -08:00
Steve Howell 7f8ea5b9f2 stream edit: Find stuff within parent_container.
This will facilitate code reuse.
2021-12-16 15:28:11 -08:00
Steve Howell 2194a51b97 refactor: Extract people.get_users_from_ids. 2021-12-16 15:28:11 -08:00
Steve Howell 6c9427340a refactor: Move user-sorting code to people.js.
We also remove the blueslip check, since it is
pretty easy to audit the callers here.
2021-12-16 15:28:11 -08:00