Commit Graph

14867 Commits

Author SHA1 Message Date
Lauryn Menard a00a1ab5ce dev-login: Rename `btn-admin` class to `btn-dev-login`.
Renames and cleans up some of the CSS rules for the `btn-admin`
class that is used in the dev login page for input elements.

Confirmed via git-grep that this class is only used on the dev
login page.
2022-12-30 21:26:42 -08:00
SameepAher 37a8bebf77 compose: Fix overflow in expanded compose box preview mode.
Fixed a bug in expanded compose box preview mode,
which lead to buttons at the bottom of the compose box
being pushed off the screen and text overflowing.

Manually tested for different screen sizes.

Fixes: #23493.
2022-12-30 17:57:17 -08:00
Lauryn Menard 19f2795e41 settings-account: Move tooltip for email change disabled to button.
Moves the tooltip when email changes are disabled to be shown on
hovering over the email button text and pencil icon. Removes the
question icon that previously showed the tooltip on hover.
2022-12-30 17:54:00 -08:00
Lauryn Menard c50de056c9 settings-account: Move disable change email logic out of template.
Moves the complicated logic in `account_settings.hbs` for whether
to disable the change email button (and show the tooltip) to
`settings_data.ts`.

This update mirrors how similar realm settings are handled,
such as `realm_name_changes_disabled`, and means that the
`realm_email_changes_disabled` bool is added to `page_params.ts`.

Prep commit for moving the email changes disabled tooltip from
a separate question icon to the disabled button itself.
2022-12-30 17:54:00 -08:00
Lauryn Menard 782cc80d99 account-settings: Refactor change email button and modal class names.
Prep commit for updating tooltip from info icon to disabled button.
2022-12-30 17:54:00 -08:00
Zixuan James Li 6d9aba8aff muted_users: Convert muted_users to typescript.
muted_users.js is another dependency of people.js to be converted into
typescript. Note that for filter_muted_users, we avoid typing persons
with a type that might get added to people.ts in the future, as it
otherwise might introduce cyclic dependency.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-30 11:21:23 -08:00
Zixuan James Li bec8e48616 muted_users: Pop muted_users from page_params.
This avoids accessing the global page_params directly.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-30 11:21:23 -08:00
Anders Kaseorg 5f76fb16b7 styles: Add overflow: hidden fallback for overflow: clip.
overflow: clip is missing in Safari < 16.
https://caniuse.com/css-overflow

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:31:06 -08:00
Anders Kaseorg 9dbb43eb71 realm_logo: Add fallback for MediaQueryList.addEventListener.
MediaQueryList.addEventListener is missing in Safari < 14:
https://caniuse.com/mdn-api_mediaquerylist_eventtarget_inheritance

Fixes #23915.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:28:20 -08:00
Sebastian Noack d4d285fc43 bootstrap: Remove print media styles.
Bootstrap's print media styles do not improve the appearance of printed
pages of this website.
2022-12-16 00:01:25 -08:00
Sebastian Noack be1ec77300 bootstrap: Remove figure element reset. 2022-12-16 00:01:16 -08:00
evykassirer 3d4374f2a6 streams: Return early from can_post_messages_in_stream for spectators.
This code path isn't currently reached for the logged out "spectator"
view, but it will be in upcoming commits. This makes sure that case
is handled properly.
2022-12-15 17:26:04 -08:00
evykassirer 53d8abe79b compose_state: Use stream_name() and topic() universally.
This change ensures that every call to find the stream name or topic
in the composebox is calling compose_state functions instead of directly
taking a value from an HTML element specified by a classname.

This has better code readability and abstracts away the classname,
and also makes it easier to change which classname we use (which
will be happening in an upcoming change as part of switching the
stream name field to a dropdown).

Note that this change means that the stream name will always be
trimmed, whereas before it was whatever the user had written even
if it had trailing whitespace. This shouldn't be an issue as far
as we (me + Tim) can tell, and also it will become irrelevant as
soon as the dropdown changes land.
2022-12-15 17:26:04 -08:00
evykassirer 7f9989003a compose_state: Break out stream_name() into separate getter and setter.
This code is equivalent, because the keep_leading_whitespace parameter
of get_or_set was never used for the stream name.

This addresses an open TODO and makes the code more readable.
2022-12-15 17:25:36 -08:00
Tim Abbott 6200f0f734 narrow: Inline set_narrow_title helper.
Now that it only has a single caller, it's easier to read the code to
get rid of this tiny helper.
2022-12-15 13:09:35 -08:00
Lauryn Menard 7c083edb96 narrow: Update narrow title for undefined filter views.
Updates `compute_narrow_title` to cover the two cases for views
with undefined filters: "All messages" and "Recent conversations".

Also, moves the call to `notifications.redraw_title` from
`set_narrow_title` and to `update_narrow_title`.
2022-12-15 13:05:22 -08:00
Lauryn Menard 7686bca385 narrow: Refactor logic for getting narrow title for browser/tab.
Creates a new function, `compute_narrow_title`, that returns a
string for the narrow title based on the current filter, so that
`update_narrow_title` can call that function, and then use the
returned string to set the narrow title.

Adds a node test for the new `compute_narrow_title` function for
cases that differ from the title generated by `filter.get_title`.
2022-12-15 13:05:22 -08:00
Tim Abbott 0bc47b1c77 invite: Display globe icon for web-public streams.
This requires both passing through the is_web_public parameter to the
template, and a bit of CSS to make the globe not huge.
2022-12-14 21:04:12 -08:00
SameepAher ebd0908ae6 invite_users: Add globe icon in web public streams.
This is implemented by reusing the stream_privacy handlebars helper.

We can't use it in the public stream case, because the design of the
invite users modal uses no space between the `#` and the stream name.

Fixes part of #23496.
2022-12-14 20:58:29 -08:00
SameepAher 7e4b9a3c01 invite_users: Discard "#" in private streams.
Added an if statement which renders "#" only when it's not "invite only".

Fixes part of #23496.
2022-12-14 20:51:43 -08:00
evykassirer 1b0a14bf40 compose banner: Add specific functions to clear warnings and errors.
Instead of removing all compose banners, we now remove only warnings
and errors -- this makes no difference right now, but this change
will allow us to add other compose banners that are cleared at
different times.
2022-12-14 20:36:07 -08:00
Josh Klar 2e825f637d css: Apply negative spread radius to message box-shadows.
This fixes a visual regression in newer Electron builds (without
regressing Firefox) for which I still don't entirely know the root
cause, where extra "borders" were being applied to messages in both
streams and PMs. Applying a negative "spread radius" to the box-shadow
properties of these elements, and moving that pixel to the "horizontal
shadow" aspect of the property (which is used to create the left-side
"ruler" effect), restores the expected look and feel.

Tested in qutebrowser (Chromium 87-based), Electron v18+v19, and Firefox
107.

Refs (and should unblock) zulip/zulip-desktop#1251
2022-12-14 17:28:37 -08:00
Anders Kaseorg b0c1b2c37f styles: Delete useless rules for stream and topic names.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-14 17:20:07 -08:00
Anders Kaseorg 34306ba1f3 styles: Don’t clip tall characters in stream and topic names.
Fixes #23867.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-14 17:20:07 -08:00
Rishant Rokaha eed13cecff
stream_settings: Fix invisible view stream btn for private streams.
If new stream is created as one of the two private options, the view stream button was not visible 
immediately, but does appear after a page refresh. This bug turns out to be caused by the wrong
selector being used in the code intended to make the button visible.

Fixes: #22556.
2022-12-14 12:44:00 -08:00
N-Shar-ma 38587b79b9 compose: Always preserve cursor position post replacement in a textarea.
Refactored (moved) the code for preserving the cursor's initial logical
position from `quote_and_reply()` in `compose_actions.js` which calls
`replace_syntax()` directly into `replace_syntax()` in `compose_ui.js`.
This ensures that anytime text in a textarea is replaced, the original
cursor position is always restored.

Earlier, this was needed to be done separately, and missing that would
lead to bugs with the cursor unexpectedly jumping on replacement.

Fixes: #23863.
2022-12-14 12:40:51 -08:00
Rohitt Vashishtha 8d539cff8f css: Remove unneeded 35px right margin from recipient row.
This margin doesn't make sense in a wider view, and is actually
a hinderance to the layout on narrower screens, and removing it still
keeps more than enough separation from the buttons on the right.
2022-12-14 12:27:23 -08:00
Rohitt Vashishtha f6f2f9e70a css: Prevent composebox to_text from getting wrapped.
Even when there is space, the to_text was getting wrapped in languages
that have more than one word for "To:", like Korean.
2022-12-14 12:27:23 -08:00
Sahil Batra d0626bbaef message_edit: Remove get_editability function.
This commit removes get_editability function and we can instead
use is_content_editable and is_topic_editable/can_move_message
functions to check the permissions. We can remove get_editability
since there is no longer a sort order to the possibilities and
it is not necessary that if a user has permission to edit content
then they can edit the topics also.

So, this commit adds is_message_editable_ignoring_permissions
check to is_content_editable and also modifies the tests accordingly.
2022-12-13 23:11:50 -08:00
Sahil Batra 98c4e11d0b settings: Organize message editing and message moving settings.
We separate the message editing and message moving settings
into different sections.

We do not change the help-links for the section headings and keep
both of them same linked to "Configure message eiditng and deletion"
as we would anyway be changing or spliting this page and can update
the links at that time.
2022-12-13 23:11:50 -08:00
Sahil Batra 939a6edf0f settings: Rename helper function to check who can edit topics.
This commit renames "can_edit_topic_of_any_message" function
in models.py to "can_move_messages_to_another_topic" and
"user_can_edit_topic_of_any_message" function in settings_data.js
to "user_can_move_messages_to_another_topic".

This change is done since topic editing permission does not
depend on message sender now and messages are considered same
irrespective of whether the user who is editing the topic had sent
the message or not. This also makes the naming consistent with
what we use for the label of this setting in webapp and how we
describe this action in help documentation.
2022-12-13 23:11:50 -08:00
Sahil Batra ac96db2d95 settings: Update labels of settings for moving messages.
This commit updates the labels for "edit_topic_policy" and
"move_messages_between_streams_policy" settings.

The label for topic editing setting is changed to
"Who can move messages to another topic" since the topic
edit permissions do not depend on message sender now and
messages are considered same irrespective of whether the
message was sent by the user editing the topic or by
someone else.

The label for stream editing setting is changed to
"Who can move messages to another stream".

These changes also makes the labels consistent with how these
actions are described in help center documentation.
2022-12-13 23:11:50 -08:00
Sahil Batra 24a1f7b792 message_edit: Topic editing permission should not depend on message sender.
This commit changes the topic edit permssions in webapp to not depend
whether the user editing the message had sent the message or it was sent
by someone else. Backend changes were done already in previous commits.

Previously, we always allowed topic edits when the user themseleves had
sent the message not considering the edit_topic_policy and the 3-day time
limit. But now we consider all messages as same and editing is allowed only
according to edit_topic_policy setting and the time limit of 3 days in
addition for users who are not admins or moderators.
2022-12-13 23:11:50 -08:00
Sahil Batra e6ec2badb5 message_edit: Make topic editing independent of allow_message_editing.
We now allow editing stream and topic of message even if
allow_message_editing if False using webapp given that is
allowed as per other topic and stream edit specific settings.

Fixes a part of #21739.
2022-12-13 23:11:50 -08:00
Sahil Batra ad9a7d2e06 message_edit: Add "Nobody" option for move_messages_between_streams_policy. 2022-12-13 23:11:50 -08:00
Sahil Batra 02eee3a04f message_edit: Add "Nobody" option for edit_topic_policy setting. 2022-12-13 23:11:50 -08:00
N-Shar-ma de4ae16989 polls: Replace `choice` with `option` in the poll editing UI.
All instances of `choice` have been replaced with `option` in the UI
for editing a poll. In code, `option` was already being used. This
ensures the same terminology is used across the code, the UI and the
related help center article.
2022-12-13 16:57:44 -08:00
Ujjawal Modi 35f05631dd css: Fix spilling out of long email on email change confirmation.
In the email change confirmation page, now long emails break to
multiple lines instead of spilling out.

Fixes #23654.
2022-12-13 16:29:10 -08:00
Yuri Sulyma 911b3b5365 ts: Convert util.js to TypeScript; add (Raw)Message type in types.ts.
Co-authored-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:23:29 -08:00
Zixuan James Li b757c1a9b6 util: Move is_pm_recipient to compose_fade_helper.
"is_pm_recipient" is not supposed to be called with an arbitrary
recipient object which might have "to_user_ids" being undefined.
Since this helper is only used with focused_recipient in
compose_fade_helper, we move it there.

Note that the helper is no longer separately tested. It is now covered
by the test case of "compose_fade_helper.would_receive_message".

(See
5e74a8d0cc/static/js/compose.js (L156-L162))

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:20:36 -08:00
Zixuan James Li 55793cb4d5 util: Stringify possibly undefined values.
This avoids "@typescript-eslint/restrict-template-expressions" when we
convert util.js to util.ts.

Note that prettier would otherwise split the first template literal
expression in half if we don't start a newline.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:20:36 -08:00
Zixuan James Li a3a0103d86 markdown: Calculate linkifier precedence in topics.
This uses the linkifier index among the list of linkifiers in the
replacement as the priority to order the replacement order for
patterns in the topic. This avoids having multiple overlapping matches
that each produce a link.

The linkifier with the lowest id will be prioritized when its pattern
overlaps with another. Linkifiers are prioritized over raw URLs.

Note that the same algorithm is used for local echoing and the
backend markdown processor.

Fixes #23715.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:16:20 -08:00
Zixuan James Li 4602c34108 markdown: Correctly retrieve indices for repeated matches.
The same pattern being matched multiple times in a topic cannot be
properly ordered using topic_name.find(match_text) and etc. when there
are multiple matches of the same pattern in the topic.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-13 15:16:20 -08:00
Sahil Batra c31dc14e9d css: Remove bootstrap CSS rules for textarea elements.
We remove bootstrap CSS rules for textarea elements
from bootstrap.css file since we already added required
CSS rules to the individual elements.
2022-12-13 12:03:06 -08:00
Sahil Batra 26b7e40ac5 invite: Add bootstrap CSS rules to emails textarea in invite overlay.
This commit adds required bootstrap CSS rules used for emails
textarea element in invite modal with existing CSS for that
element in zulip.css. We also change the selector to use class
instead of ID such that the dark theme CSS can take precedence
when using dark theme.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 264bfd4583 message_edit: Add bootstrap CSS rules to message edit textarea.
This commit adds required bootstrap CSS rules used for message-edit
textarea element with existing CSS for that element in zulip.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 735743879a compose: Add bootstrap CSS rules for compose textarea.
This commit adds required bootstrap CSS rules used for
compose textarea element in with existing CSS for that
element in compose.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 74b985ccce billing: Add bootstrap CSS rules for textarea in sponsorship page.
This commit adds required bootstrap CSS rules used for textarea
element in sponsorship page with existing CSS for that element
in billing.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra cb699d6c10 support: Add bootstrap css rules to textarea element in support page.
This commit adds required bootstrap CSS rules used for textarea
element in support page with existing CSS for that element in
portico_signin.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra 2e93a4ccd6 integrations_dev_panel: Add CSS rule for textarea elements.
This commit adds bootstrap CSS rules used for textarea element
in devtools integrations panel in integerations_dev_panel.css.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
Sahil Batra fc21e68a9e settings: Set margin-bottom for email field in deactivate modal.
This commit adds margin-bottom property to CSS of email field
in user deactivation modal with other CSS properties for this
field in settings.css since we are going to remove bootstrap
CSS rules in further commits.
2022-12-13 12:03:06 -08:00
Sahil Batra 1c0b9b8c7a css: Extract common bootstrap CSS rules for textarea in settings.
This commit extracts some common bootstrap rules used for textarea
elements in settings (both organization and stream settings) and
this rules are added for settings_textarea class. We also add
settings_textarea class to the textarea elements in settings.

This change is done so we can safely remove textarea CSS rules
for bootstrap.css as a part of our process to remove bootstrap
without changing existing design.
2022-12-13 12:03:06 -08:00
N-Shar-ma 571f6b1e91 message_edit: Fix the name of a property being accessed wrongly.
The `stream_id` property of a stream object was being wrongly accessed
as `id`, which does not exist, in the function
`get_available_streams_for_moving_messages()`

This led to the current stream not being rendered in the dropdown list
as expected in the `Move Topic` modal when the user does not have the
permission to post in the current stream.
2022-12-13 11:54:30 -08:00
Aman Agrawal 36354f0625 message_list: Remove message_list.narrowed from code. 2022-12-12 18:04:11 -08:00
Aman Agrawal e5b5bd4f28 narrow: Don't update selection if user changed narrow.
We don't need to select the message after fetching messages if
the user changed the narrow in the meanwhile.

Note that in this context, message_lists.current ===
message_list.narrowed.
2022-12-12 18:03:11 -08:00
Tim Abbott 5f4faaf22c message_fetch: Pass msg_list to load_messages_for_narrow.
This tweak makes the code easier to reason about and may also help
generalize the codebase to support maintaining multiple message lists.
2022-12-12 08:45:58 +00:00
evykassirer 7d17a11db0 compose banner: Rename banner shown after message is sent.
This is both more clear regarding what the banner does, and is now
in the same folder as the other compose banners.
2022-12-11 17:51:35 -08:00
evykassirer 44c0be7a31 drafts: Move functions out of `launch()` context, for other use.
No functional changes. Moves functions so that other code in this
file can access them.
2022-12-11 17:46:52 -08:00
Clara Gallon 1fea98499d settings: Add "(200×25 pixels)" to wide organization logo description.
Fixes part of #22121.
2022-12-09 17:42:24 -08:00
Anna Larsson 305fb62fb0 search reference: Reorder operators.
The new ordering matches that used in the Help Center search operators
page, which we just reordered to better highlight more frequently used
features.

Fixes #23768.
2022-12-09 17:37:37 -08:00
Anna Larsson 69304eb2d2 search reference: Replace 'email' with 'user'.
Previously, we used `sender:email`, for example, in our examples for
how to use search operators. This is correct for what ends up in the
search input, but the typeahead has a much nicer experience for
selecting a user, and the emails may be fake due to limited
email_address_visibility, so it's clearer to just refere to a user
here.

Fixes part of #23768.
2022-12-09 17:37:29 -08:00
David Rosa a153e9232e Rename "operators" to "filters" in "Search operators" reference.
Changes all the uses of the word "operators" to "filters" in the
in-app "Search operators" reference to align with the updated help
center documentation.

Fixes #23767.
2022-12-09 13:52:13 -08:00
mustafa0x 3b0e311f83
search: Fix missing ARIA role on span used as button. 2022-12-09 13:29:59 -08:00
Sayam Samal cfacb6fe25 user_profile: Convert preview profile to sticky button.
Having the preview profile button always visible makes it more
accessible when the user is at a random scroll positon in the
profile settings.
2022-12-09 13:27:15 -08:00
Rebeca Carvalho a516a13220
move messages: Use case-insensitive sorting in stream selection.
Previously, the options in the stream selection dropdown were sorted in a case-sensitive
fashion, which felt a bit harder to use than just sorting alphabetically irrespective of case.

Fixes: #23283
2022-12-09 11:19:48 -08:00
Sahil Batra 15dbf9742d stream_settings: Remove code for stream privacy modal.
This commit deletes all the functions, CSS and other code
for stream privacy modal since we have udpated the UI to
show stream permission settings always in "General" section
and not inside the modal.

Fixes a part of #19519.
2022-12-09 11:16:26 -08:00
Sahil Batra 404ce8887c stream_settings: Add code to live-update stream settings.
Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler 6237a7b284 stream_settings: Add code to save changes in stream permissions.
This commit adds code to save changes in stream permission
settings.

This commit makes some changes to code in settings_org.js to
handle stream settings and add corresponding handler for
save button in stream_edit.js. We also add a new function
get_request_data_for_stream_privacy to get the data for
stream privacy which can be send with the API request.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler a2a92b52f6 stream_settings: Add code to discard changes in stream permissions.
This commit adds code to discard changes in stream permission
settings.

This commit makes some changes to code in settings_org.js to
handle stream settings and add corresponding handler for
discard button in stream_edit.js.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler 445957df05 stream settings: Show save/discard widget when settings change.
This commit adds code to show save-discard widget when stream
permission settings are changed and subsequently hide it when
the setting is again changed to original value.

Some important code changes -
- Added code in "settings_org.js" to handle stream settings.
- Added handler in "stream_edit.js" to show or hide the
save-discard widget when settings are changed.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Julia Bichler b871ffe712 stream settings: Always show stream settings.
We now show the stream permission settings - stream privacy,
stream post policy and stream message retentions setting,
always in the "General" section of stream settings instead
of showing it in the modal. The setting elements are
disabled for users who cannot change them.

Some important changes are -
- Add proper classes and IDs to the elements such that
code in settings_org.js can be used to set and change these
settings.
- Code in "settings_org.js" is updated to be able to set
stream message retention setting while rendering the page.
- Added enable_or_disable_permission_settings_in_edit_panel
function in stream_ui_updates.js (since that will also be
used in live updating code) to disable the setting elements
if required.
- We also update update_web_public_stream_privacy_option_state
function such that we can correctly enable/disable web-public
option in stream edit panel based on permissions.
- Added code for save-discard widget in stream_settings.hbs in
this commit but code to implement the correct behavior of it
will be added in further commits.

Fixes part of #19519.
2022-12-09 11:16:26 -08:00
Sahil Batra e64c1948ed app_components: Refactor css for save-discard widget.
We change the CSS for save-discard widget to not be inside
"#settings_page" selector such that it can be used as a
common component for stream settings also.

This commit also updates the selectors to be more specific
such that the ".new-style.button" css cannot override
these rules.
2022-12-09 11:16:26 -08:00
Sahil Batra 59b7a68e71 settings_org: Update populate_data_for_request to have module-level scope.
This commit changes populate_data_for_request to have module-level scope
and not be defined in register_save_discard_widget_handlers, so that we
can use this function for stream settings too in further commits.
2022-12-09 11:16:26 -08:00
Sahil Batra c96dd02084 settings: Remove unused CSS and corresponding organization-submission class.
This class was used for setting margin-top as 0 but since the default value
of this property is already 0, this CSS is not required and thus we can
remove this class also since it is not used anywhere else.
2022-12-09 11:16:26 -08:00
Lauryn Menard 6b3fbab520 narrow-banner: Update default empty banner text to be more general.
Updates the default empty narrow banner text to be more generally
applicable, particularly in the case when all messages have been
moved to a new topic.
2022-12-08 13:01:33 -08:00
Alex Vandiver bfbdd8fd7e analytics: Show N/A for guests and file storage when those are not known. 2022-12-08 12:42:41 -08:00
Lauryn Menard dfa8ef09d8 org-settings: Fix jquery id selector for join organization settings.
Fixes the id used to select and disable the properties for org
admins on the organization permissions settings tab.
2022-12-08 11:36:32 -08:00
evykassirer 291df7ac2a compose notifications: Add # before stream name in notification header. 2022-12-07 16:17:09 -08:00
Sahil Batra ee04677d4b settings: Remove ID from discard button in save-discard widget.
This commit removes ID from discard button in save-discard widget.

Generating IDs using variables results in difficulty to grep
the code and we can anyway access the discard button by using
ID of the settings-subsection-parent div. Also, we do not use
ID to access this button, so we can change this safely.
2022-12-07 10:23:47 -08:00
Sahil Batra 821a409c8b settings: Remove ID from save button in save-discard widget.
This commit removes ID from save button in save-discard widget.

Generating IDs using variables results in difficulty to grep
the code and we can anyway access the save button by using
ID of the settings-subsection-parent div.
2022-12-07 10:23:47 -08:00
Sahil Batra 4b46f08b5f settings: Use subection-parent div to get subsction.
We used id of save-button to get subsection parameter
which is passed to get_complete_data_for_subsection.

This commit now changes it to instead get subsection
from settings-subsection-parent div. We also change
the id of settings-subsection-parent div of organization
joining settings in this commit to be a more reasonable
name as per this change.
2022-12-07 10:23:47 -08:00
Anders Kaseorg 872f4b41c1 ci: Check that non-scripts aren’t marked executable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-07 09:54:01 -08:00
Akarsh Jain 761ca16d6d
css: Add min-width to user presence dot. (#23526)
Previously user presence dot in the right sidebar becomes narrower 
when there is unread counter, and as such, this commit adds a min-width 
to the user presence dot.

Fixes: #23519
2022-12-06 16:15:55 -08:00
evykassirer e9045dcd58 compose: Rename compose_error to compose_banner.
It no longer handles only error messages, but banners of multiple
types.
2022-12-06 15:43:49 -08:00
evykassirer f9c72701c6 compose: Migrate compose_private_stream_alert to use compose_banner.
This is part several updates for #22524.

Notes:

* data-stream_name isn't needed in the template (before or after),
  since there is not even an action button that could use it.
2022-12-06 15:43:34 -08:00
evykassirer 086f02a3ab compose: Migrate compose_not_subscribed to use compose_banner.
This is part several updates for #22524.

This commit also removes `compose_error.hide()` since there is only
one remaining use of it (which has been replaced by the contents of
`hide()`). Eventually `#compose-send-status` should be replaced
fully in a future PR, after we rewrite the upload banner to use
the new banner template.

Testing note: I removed the test test_compose_not_subscribed_clicked
since it heavily relies on the old way of rendering banners and is too
UI-focused (instead of logic focused) for me to feel like it's worth
testing that the banner is removed when clicking the button.
2022-12-06 15:43:34 -08:00
evykassirer 8ced075643 compose: Migrate compose-all-everyone to use compose_banner.
This is part several updates for #22524.

Testing note: I removed the test test_compose_all_everyone_confirm_clicked
since it heavily relies on the old way of rendering banners and is too
UI-focused (instead of logic focused) for me to feel like it's worth
testing that the banner is removed when clicking the button.
2022-12-06 15:43:34 -08:00
evykassirer ab5d088188 compose: Migrate compose_invite_users to use compose_banner.
This is part several updates for #22524.

Testing note: I removed the tests test_compose_invite_users_clicked
and test_compose_invite_close_clicked, since they heavily relied on
the old way of rendering banners and were too UI-focused (instead of
logic focused) for me to feel like it was worth testing that the
banners removed when clicking the buttons.
2022-12-06 15:43:34 -08:00
evykassirer f1c6fc13e7 compose: Migrate generic error to use shared banner template.
Error banners were rendered in a different place than warnings.
Now compose errors and warnings share the same template and styling
in compose_banner.hbs

Testing notes:
* I removed test_message_overflow since it seemed not to test
  anything that test_check_overflow_text wasn't already testing.
* private_message_recipient() can't be called to set emails to non-valid
  emails, so `invalid_recipient` cannot be tested (and is likely very
  difficult to trigger in production, if possible at all).
2022-12-06 15:43:33 -08:00
evykassirer 85cbd324eb compose: Create shared compose banner and use for resolved topic warning.
This is the beginning of a fix for #22524 which converts several
banners to a new style. As a part of that set of changes, this
commit creates the shared template and warning styling. The
resolved topic warning was picked (for no particular reason)
to migrate first. Further commits updating other banners
to follow.
2022-12-06 15:42:07 -08:00
evykassirer dc4f933f4f compose banners: Fix move topic permissions.
Not resolving a topic does not involve moving messages between streams.
2022-12-06 15:40:41 -08:00
Aman Agrawal ca835ec943 actions_popover: Attach emoji_popover to correct reference.
If the selected message was different from the message where
actions popover was present, it resulted in emoji popover being
attached to the selected message instead of the one where
actions popover was present.
2022-12-06 09:58:40 -08:00
Aman Agrawal b1d0c36744 emoji_picker: Remove unused arg.
Looking at the history of build_emoji_popover, it never took a
3rd argument.
2022-12-06 09:58:40 -08:00
Aman Agrawal bab596e5b4 emoji_picker: Directly use $elt. 2022-12-06 09:58:40 -08:00
Aman Agrawal 96a93339cd popover: Remove unused code.
exclude_tippy_instance was not being used correctly since it was
never defined as an `opts` property for `hide_all_except_sidebars`.

Everything seems to be working fine without this. I recall that
popovers seems to be hidden before they were displayed for which
this was required but it doesn't seem to be needed anymore.
2022-12-06 09:58:40 -08:00
Aman Agrawal 13b478f81f popovers: Add comment to clarify hideAll is a tippy function.
This helps some reviewing the code or just skimming through.
2022-12-06 09:58:40 -08:00
Aman Agrawal ae3e3fa3cc popover_menus: Add a comment explaining why we use parse_html. 2022-12-06 09:58:40 -08:00
Aman Agrawal eb45925b1a actions_popover: Use tippyjs instead of bootstrap to display popover.
Fixes #23494
Popover now automatically displays on left when there is not
enough space top or bottom of the reference element.
2022-12-06 09:58:40 -08:00
Aman Agrawal 6a1ae465cc css: Let actions popover icon take maximum possible width & height.
We need to fill width of `actions_hover` with padding of
`zulip-icon`, so that hovering over `.actions_hover` shows you
tooltip and clicking on it shows popover.
2022-12-06 09:58:40 -08:00
Aman Agrawal 4593fcf8d1 actions_popover: Move data to display the popover to a new module.
Since we are switching to tippyjs to display popovers, extracting
this data in a commit of its own, makes further changes easier to
review and merge.

Also, we could add tests with full coverage on the data
provided to popovers, possibly a good first issue for beginners.
2022-12-06 09:58:40 -08:00
Aman Agrawal 8b6dc955f1 popover_menus: Stop propagating click events when opening a popover.
This could result in things like compose box being opened by the click
that opens the popover.
2022-12-06 09:58:40 -08:00
Aman Agrawal 223dca65b2 popovers: Remove part of `reminder` feature.
While `reminder` feature is disabled right now, we need to delete
these functions to avoid conflicts when porting the actions
popover from bootstrap to tippy.
2022-12-06 09:58:40 -08:00
Aman Agrawal 0b9ef0dcf6 popover_menus: Keep element click handlers self-contained.
Hide the popover explicitly inside the event handler of the element.
Also, stop propagating events outside the popover. We add
`navigate_and_close_popover` class to links inside popovers
which don't have any click handler and do the same for them.
2022-12-06 09:58:40 -08:00
Aman Agrawal 95224d680f popover_menus: Adjust comment.
Looking at this again, I was just confused about how we
were propagating events and this seems to be working as it should.
2022-12-06 09:58:40 -08:00
Aman Agrawal 43578847e3 popover_menus: Remove incorrect `return`. 2022-12-06 09:58:40 -08:00
Sahil Batra 5e74a8d0cc subscriptions: Remove redundant CSS rule.
We can remove the "padding-left: 0px" rule for
"label.radio" element now since the default value
for padding property is 0 and we have also removed
the bootstrap applied "padding-left: -20px" rule
in the previous commit.
2022-11-30 17:35:22 -08:00
Sahil Batra a04128f0bd bootstrap: Remove radio input CSS from bootstrap.css.
We have already added the CSS rules added by bootstrap to
individual elements with common rules for all radio buttons
being added in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra 53eeae9019 compose: Do not use bootstrap css for "Enter to send" radio buttons.
We rewrite the CSS rules, handled by bootstrap for the radio buttons of
"Enter to send" setting, to compose.css as we are in process of
removing bootstrap.

The line-height property added to input element by bootstrap is not
added to subscriptions.css since it is already added for all inputs
in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra d2b48fab27 streams: Do not use bootstrap CSS in stream privacy choices inputs.
We rewrite the CSS rules, handled by bootstrap for the radio buttons
for stream privacy choices (in both stream create and edit form),
to subscriptions.css as we are in process of removing bootstrap.

The settings-radio-input-parent block in subscriptions.css is moved
to be top-level instead of being nested inside "stream_privacy_modal"
and "stream-creation-body" block, such that we can use this class
in future for resusable components (like settings_checkbox).

The bootstrap CSS rules are also added to this
settings-radio-input-parent selector.

The max-height property added to label by bootstrap is not added
since it does not applies to non-replaced inline elements.
The line-height property added to input element by bootstrap is
not added to subscriptions.css since it is already added for all
inputs in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra 55aaf1d56d settings: Do not use bootstrap css in radio-type display settings.
We rewrite the CSS rules, handled by bootstrap for the radio
buttons in display settings (both user and realm-level defaults),
to settings.css as we are in process of removing bootstrap.

This commit adds a new class "display-settings-radio-choice-label"
to radio label elements in the display settings and the bootstrap
CSS rules along with existing CSS defined by us for radio-type
display settings are added to this class.

This change will help us in future where we may want to have
reusable components (like settings_checkbox) for radio-type
settings with visual preview.

The line-height property added to input element by bootstrap is
not added to settings.css since it is already added for all inputs
in zulip.css.
2022-11-30 17:35:22 -08:00
Sahil Batra f8065dcd3d streams: Rename radio-input-parent class to settings-radio-input-parent.
This commit renames the radio-input-parent class for parent div of
stream privacy radio inputs to settings-radio-input-parent.

This change is done so that we can use this same class name for adding
other similarly styled radio inputs to be used in settings in future.
2022-11-30 17:35:22 -08:00
Sahil Batra 8f149750f3 email_log: Do not use bootstrap css for radio buttons.
We add the CSS rules handled by bootstrap for the radio
buttons in forward email modal to email_log.css as we
are in process of removing bootstrap

The elements for which CSS rules have been added are label
with "radio" class and "radio" type input elements.

The max-height property added to label by bootstrap is not
added since it does not applies to non-replaced inline
elements.
2022-11-30 17:35:22 -08:00
Sahil Batra 00ad7e5aeb development: Add CSS file for emails page in dev server.
Previously, CSS rules were added inline for emails page in
dev server. This commit adds a new file which contains
CSS rules for the emails page in dev server. This will
also help us in adding focus for the radio buttons in
the page, which cannot be added inline to the elements,
when we remove the use of bootstrap for this page.
2022-11-30 17:35:22 -08:00
Hemant Umre f7c6d1dd77 left_sidebar: Add login link to left sidebar for logged-out users.
It can sometimes be unclear to logged-out users why they
are not seeing all their subscribed streams in the left sidebar.

To reduce the chances of users being confused, added a login link
at the bottom of the streams list for logged-out users.

To avoid leaking any information, the link is shown regardless of
whether or not there are actually any additional streams in the
organization.

Fixes #22844.
2022-11-29 16:35:36 -08:00
Sahil Batra 038880338f streams: Pass max-length parameters to stream info modal.
We were not passing max_stream_description_length and
max_stream_name_length parameters to change_stream_info_modal
template and thus the maxlength attribute was not being set
correctly for the stream name and description input.

This commit updates the code to pass these parameters to
change_stream_info_modal template. We also remove these
parameters from the data passed to stream_types template,
since these parameters are not required there.
2022-11-29 16:22:48 -08:00
Aman Agrawal 38a4751b7b recent: Sort PM recipients by their last sent message id.
Fixes #23563
2022-11-29 11:29:12 -08:00
Aman Agrawal c0ad0b3b10 recent_senders: Return senders in most recent sender first order.
Since the library is named `recent_senders`, most recent sender
first order is expected from this library.
2022-11-29 11:29:12 -08:00
Aman Agrawal d3b8f6965c recent_senders: Rename process_message_for_senders.
Since it only processes stream messages, change its name to
`process_stream_message`.
2022-11-29 11:29:12 -08:00
Aman Agrawal eab2dbab1e Revert "recent: Remove participant avatars from PM rows."
This reverts commit 7e1fe7e569.
2022-11-29 11:29:12 -08:00
Lauryn Menard 3fe2f208ae integrations-docs: Remove images of bot type dropdown menus.
Removes images of the bot type dropdown menus for creating new
bots because they are no longer up-to-date and picking an option
from a dropdown does not seem like it would require a screenshot.
2022-11-29 11:03:28 -08:00
Aman Agrawal b6a29a03f5 left_sidebar: Add border radius to the selected stream. 2022-11-28 20:23:57 -08:00
Alya Abbott dfd97542b3 help center: Document message actions. 2022-11-28 12:07:57 -08:00
Aman Agrawal a5ec77bc45 upload: Set focus to textarea after exiting upload window.
Restore focus back to textarea after user clicks on the upload icon
and exit the upload window.
2022-11-27 13:32:02 -08:00
Aman Agrawal a1aaf4a52d compose: Fix file link text being selected after upload.
https://github.com/fregante/text-field-edit/pull/18 adds the option
for `replace` function to not select the replaced text. We use it
to fix the issue of file link being selected after user uploads
a file via `drag-drop`.
2022-11-27 13:32:02 -08:00
Aman Agrawal 77c7fe4699 Revert "compose_ui: Revert changes for replace_syntax done in 1ca4566eb2."
This reverts commit 5c833f0423.
2022-11-27 13:32:02 -08:00
Sahil Batra 7448e2bd42 settings: Fix custom input for user email-notification-batching setting.
The custom input was not being shown when changing user email
notification batching period setting dropdown to "Custom" option.
This was because parse_time_limit was undefined in case organization
settings was not loaded till then, and the code raised an error.

This commit changes the code to define parse_limit_function at
module-level instead of defining it in
register_save_discard_widget_handlers which is called only when
build_page is called which happens only when organization settings
is opened before changing the notification batching setting.

Fixes #23674.
2022-11-27 13:30:49 -08:00
Anders Kaseorg 5cc92365b8 dark_theme: Declare color-scheme CSS property.
This allows the browser to select a more appropriate color for the
browser scrollbars, for example.

https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-27 13:18:52 -08:00
Anders Kaseorg 21f8d26040 dark_theme: Move color scheme classes from body to root element.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-27 13:18:52 -08:00
Anders Kaseorg 2cf64b569e people: Fix misleading comments and tests for utcToZonedTime.
The reason utcToZonedTime would return an invalid Date (i.e. ‘new
Date(NaN)’) is because we passed in an invalid timezone.  Fix the
comments and tests to reflect this; remove unnecessary mocking and the
misleading ‘instanceof Date’ check.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-24 09:18:11 -08:00
Lauryn Menard 75630fb151 message-fetch: Update empty narrow check to include opts message list.
In 16c45aa, the check for an empty narrow was updated to no longer
confirm if no messages were returned by the message fetch request.

Updates the empty narrow check to confirm that the messages fetched,
and being processed are for the current / narrow message list before
showing an empty narrow.
2022-11-23 12:06:56 -08:00
Aman Agrawal 69d2684126 people: Verify `utcToZonedTime` returns a `Date` before formatting it.
`current_date` being invalid here could result in `user card`
not being displayed to users. So, it is important to verify that
the date is valid so that we don't run into any errors.

This fixes (unverified) an issue where user card was not being
displayed to some users on Zulip Desktop app because `current_date`
was not valid.
2022-11-23 12:03:52 -08:00
petercabra 8139793dc5
settings: Hide deactivated users panel by default for members.
Non administrator users were shown the deactivated users in sidebar
menu; this could be distracting, as there's not much expected interaction
for non-administrators with this. Keep it available but hidden behind the
extra click for panels that are primarily for administrators.

Fixes #23235.
2022-11-23 11:46:16 -08:00
Hemant Umre a451fe861e left_sidebar: Fix section divider not shown when all streams are muted.
This fixes a bug where when all the streams in a section
in the left sidebar are muted, the section divider disappears.

The bug is caused by not considering muted streams when writing
the logic for when to show/not show section divider this commit
fixes it.

fixes #23241.
2022-11-23 11:43:40 -08:00
Sahil Batra 8241e2d353 settings: Refactor code for realm message retention setting.
This commit refactors the code for realm message retention
setting which will help us in reusing some code when adding
save-discard widget for stream settings in further commits.

Following changes have been done in this commit -

- Renamed the "retain_for_period" option to "custom_period"
and "retain_forever" option to "unlimited" to match with
the stream settings options such that we can reuse the code.

- Updated set_message_retention_setting_dropdown such that
it can be used for stream message retention setting as well.
2022-11-22 17:14:35 -08:00
Sahil Batra de259b3c4a stream_settings: Refactor code for stream message retention setting.
This commit refactors the code for stream message retentions setting
to match it with the other time limit settings -

- Rename the "Retain for N days after posting" option to "Custom".
We also update the option value from "retain_for_period" to
"custom_period".

- Change the label of custom input to "Retention period (days)"
as it is more descriptive and clear than just labelling it as "N".

- The custom input is also moved to be below the dropdown and
also has left margin as with the other time limit realm settings.
2022-11-22 17:14:35 -08:00
Sahil Batra ec1f41eb9d settings: Rename dependent-block class to dependent-settings-block.
This commit renames dependent-block class to dependent-settings-block
and also moves the CSS to app_components.css. This class will now
only be used for this particular type of custom inputs and thus
we do not need ID in the selectors for applying the CSS.
2022-11-22 17:14:35 -08:00
Sahil Batra 30f4e67aaa settings: Rename "org-subsection-parent" class to "settings-subsection-parent".
This commit renames the "org-subsection-parent" class used for
organization settings subsections to "settings-subsection-parent"
such that we can use same for the stream settings and avoid
duplicating code for handling save-discard widget which will be
added in future.
2022-11-22 17:14:35 -08:00
Sahil Batra e9316499cb settings_org: Pass subsection elem to get_subsection_property_elements.
We passed subsection elem to get_subsection_property_elements function
in all cases except the one when calling from discard button click
handler and we passed the input elem instead in that case.

This commit changes the code to pass subsection element directly
in the discard button click handler as well such that we can use
get_subsection_property_elements function for the stream settings
code and do not find the subsection element inside the function.
2022-11-22 17:14:35 -08:00
Sahil Batra d00c428c88 settings: Refactor code that handles radio type settings.
This commit changes the settings code to consider the
parent div of the radio inputs as prop-element and not
individual input elements since all inputs are actually
for a single setting. We still need to handle these settings
as special cases at some places but that can also be fixed.

As a result of this change, we can use ID to get setting
name from the element in populate_data_for_request.
2022-11-22 17:14:35 -08:00
Sahil Batra 662998d431 settings: Add id for display and notification settings elements.
This commit adds id attribute to display and notification settings
elements except for the radio-type settings which will be handled
later in further commits and for checkbox type settings which
already had id.

The id will only be used for default settings section but they
have been added to user settings also as both of them share common
template.

This is a prep commit for refactoring the code for radio-type
settings in settings_org.js.
2022-11-22 17:14:35 -08:00
Sahil Batra fe179412ce settings: Move save-discard widget css to app_components.css.
We move the css to app_components.css from settings.css because
we are going to add save-discard widget in stream settings as
well and thus we can reuse the CSS there.
2022-11-22 17:14:35 -08:00
Sahil Batra 515446039c stream_edit: Remove unused handler.
We do not need this handler anymore since "Micromodal"
makes sure that events are not propagated and the
behavior is as expected without this handler.

Also, there are no elements with selectors used in
this handler.
2022-11-22 17:14:35 -08:00
Ujjawal Modi 23f2d44c6d settings: Improve success feedback for deleting alert words
We add the alert word that was removed to the banner text, and also
reorder a bit for clearer UI.

Fixes #22813
2022-11-22 16:23:56 -08:00
Tim Abbott 016c4700ab css: Remove Bootstrap CSS reset for h5/h6.
This has no visual changes.

I hand-verified all the places we include these elements in the UI:
* Markdown rendered inside the app.
* Markdown rendered on portico pages.
* The only such element in our HTML templates is the <h5>s for
  organization logos.

For a couple of these, we were relying on the default margins provided
by Bootstrap.
2022-11-22 13:55:21 -08:00
Tim Abbott ed6a462c47 css: Delete Bootstrap navbar CSS.
This is not used by Zulip directly; the one place we have a .navbar is
on the /hello page, which actually is just a naming collision for the
"navbar" in the mobile device widget.
2022-11-22 13:55:21 -08:00
Tim Abbott 2a3f708e9a gear_menu: Delete unused Bootstrap tabs code.
Before 2017, Zulip's manage streams and settings UIs were tab in the
same pane position as our current message feed and recent topics.

That original implementation was implemented using Bootstrap tabs;
while it hasn't been in use for years, we had a bunch of stale code
related to it leftover in this module.
2022-11-22 13:55:21 -08:00
Aman Agrawal fd422a4dd8 resize: Call `resize_app` after hiding recent topics first time.
See the code comment for why it is being called. We also remove the
unused `message_feed_shown` which was added to be used for this
purpose.

I decided to not call this with `requestAnimationFrame` since it
is changing position of elements in DOM and not letting browser
do a reflow after that can lead to wrong calculations later on.
2022-11-22 13:55:21 -08:00
Aman Agrawal a0f42edaa2 message_scroll: Only run `scroll_finished` when RT is not visible.
We didn't use to control how `active` class is set on
`#message_feed_container`. It was done by bootstrap on its own
and it doesn't even matter if `message_feed_container` is visible
for it to have `active` class according to bootstrap. So, we only
run `scroll_finished` when recent topics is not visible which
seems logical.
2022-11-22 13:55:21 -08:00
Tim Abbott 930f588fff css: Remove bootstrap navbar-search CSS.
I confirmed all of these rules were already overridden by our own CSS
on the only element with this CSS class.
2022-11-22 13:55:21 -08:00
Tim Abbott 9b5fb74f90 css: Remove bootstrap form-search CSS.
Only a couple lines were effective on a single element, so we just
inline those to the element in question.
2022-11-22 13:55:21 -08:00
Tim Abbott 4cd79d00ee bootstrap: Remove <address> CSS reset.
<address> Tag is not used.
2022-11-22 13:55:21 -08:00
Tim Abbott c8290421a1 css: Replace CSS reset for <cite> with local rules.
Browser default font-style for `cite` is `italic` and
there is no default value for `blockquote`.
2022-11-22 13:55:21 -08:00
Tim Abbott 3619fb2c29 css: Remove Bootstrap strong/em reset.
These roughly match the user-agent stylesheet; some browsers do
`font-weight: bolder` instead for strong, but the difference shouldn't
be important for us.
2022-11-22 13:55:21 -08:00
Tim Abbott 0ebcdf6838 css: Remove Bootstrap audio element rule.
display: none is already the default for audio elements without
controls.
2022-11-22 13:55:21 -08:00
Lauryn Menard 024932a489 narrow-banner: Fix empty narrow banner titles with user's full name.
Fixes an issue introduced in 6b4ab21 when we started using the
user's full name for empty narrow titles in a single operator
narrow of either "pm-with", "group-pm-with" or "sender".

For these empty narrow titles, any ', & or < characters in the
user's full name are not escaped.
2022-11-22 11:58:21 -08:00
Lauryn Menard a67a622adc recent-conversations: Check for data change when processing message.
Add in a check to `recent_topics_data.process_message` so that we
know if any conversation data was updated and can rerender the
based on that information.
2022-11-20 17:26:26 -08:00
Aman Agrawal 6926415c26 recent: Don't modify `row_focus` if table is not focused.
This fixes an error in the `inplace_rerender` code when we
are trying to remove a rendered row and correcting the `row_focus`
if it is on the row being removed. If the table is not in focus,
we don't need to do anything.
2022-11-20 17:24:45 -08:00
Anders Kaseorg eb2c822d3f eslint: Enable object-shorthand avoidExplicitReturnArrows option.
This is equivalent in the absence of ‘this’ (which ESLint knows to
check for).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-17 16:48:44 -08:00
Aman Agrawal f0d87fcf6e unread_ops: Provide more responsive feedback flagging msgs read/unread.
Processing 1k messages takes roughly 1s on a live server like
chat.zulip.org, which is a good enough duration after which
user will be looking to get some feedback on the request. Once
we show the in-progress banner, it makes sense to do bigger
batches to speed up the process.
2022-11-17 10:55:34 -08:00
Tim Abbott 59633e36cb unread: Simplify include_anchor for mark all as read. 2022-11-17 10:26:57 -08:00
Tim Abbott 911cf46c72 unread: Fix mark all as read when oldest unread message is muted.
As detailed in the comment, the new "mark all as read" bankrupcty code
path would fail to mark as read muted stream messages that are older
than the oldest unread non-muted message.

This was because of the semantics of the `first_unread` anchor value
being actually "fire unmuted unread".

We can just change this to "oldest", because we're already using an
`is:unread` for the narrow query; doing so likely is a small
optimization, since we save the query to compute the first unread.
2022-11-17 10:26:57 -08:00
Lauryn Menard 16c45aaf42 narrow: Show empty narrow banner if all topics muted in stream.
Adjusts the check in `message_filter.process_results` to happen
after the messages have been processed so that the empty narrow
banner is shown if there are no messages in the current message
list, which covers the case of there being no messages returned
from the server (e.g. a keyword search, no private messages with
a user) and the case of all existing stream topics being muted
by the current user.
2022-11-17 10:24:49 -08:00
Aman Agrawal 7e1fe7e569 recent: Remove participant avatars from PM rows.
Fixes: #23561.
2022-11-17 09:37:46 -08:00
Tim Abbott 14e14c4d35 unread: Do full rerender of recent view on mark unread.
This matches the current bulk-operation behavior of the message lists,
and avoids spending an enormous amount of time adjusting unread counts
once per message in a loop over thousands of messages.

Also add some comments on adjacent code paths.
2022-11-17 09:06:33 -08:00
Lauryn Menard 79c0d7fbab recent-conversations: Update logic for processing messages.
As of 550a32b, when private messages were added to recent
conversations, `recent_topics_data.process_message` will
always return true.

Updates `recent_topics_data.process_message` for no return
value. Also, removes the `topic_data_changed` logic from
`recent_topics_ui.process_messages` and instead checks for
messages to process before updating the data and calling the
rerender.

`recent_topics_ui.complete_rerender` first checks for whether
the recent conversations view is visible before rerendering.
2022-11-17 09:05:24 -08:00
Sahil Batra 5c833f0423 compose_ui: Revert changes for replace_syntax done in 1ca4566eb2.
This commit reverts the changes for replace_syntax in 1ca4566eb2
and we again use JS replace instead of replace from text-field-edit.

We do this change because replace from text-field-edit leaves the
replaced text selected, which we don't want. This change is
temporary and we can probably use replace method from
text-field-edit once this issue is fixed in upstream.
2022-11-17 08:29:11 -08:00
Aman Agrawal c3589ad763 unread_ops: Fix plural and singular forms of text. 2022-11-17 00:46:26 -08:00
Tim Abbott 3aec5564eb popovers: Offer mark as unread regardless of fetch_status.
Now that we're using the new /messages/flags/narrow API endpoint, we
don't need this conditional.
2022-11-17 00:46:26 -08:00
Aman Agrawal 0bc0a701f8 unread_ops: Use the improved /messages/flags API to mark all as read.
Fixes #23406.
Fixes #14053.

This also uses the new alert banner system.

It is not clear if we want to scroll user to the end of the narrow
after this update is complete. There is a "scroll to bottom" button
for users who want to be placed at the end of the narrow but there
is no reverse option for users who don't. So, maybe not changing
the scroll position is preferred especially since we now use
banners for the update where a user could have been reading something
while we were updating the message flags in the background.

We do not handle the case of `mark as read` and `mark as unread`
both running in batches at the same (This is a somewhat rare case
given the high cap on `NUM_OF_MESSAGES_UPDATED_PER_BATCH` but
possible.).

`unread.declare_bankruptcy` is no longer used in the code but
we keep it since it is used extensively in tests.
2022-11-17 00:46:26 -08:00
Aman Agrawal c876e12b86 unread_ops: Let server do the mark as unread for us.
Previous algorithm was not correct if we didn't have full data for
the current narrow loaded from the server. #23512 adds the support
to mark messages in a narrow unread after a give message_id.

Added a new alert banner to indicate loading and success states of
an ongoing request. This is useful when requests can take a long
time to complete.
2022-11-17 00:46:26 -08:00
Aman Agrawal ec1a114c7e left_sidebar: Fix extra space between stream header and PM header. 2022-11-16 12:00:11 -08:00
Tim Abbott 6f1a341d2d compose: Increase z-index for compose box.
Following b563fdc537, the z-index of the
compose box (2) tied with that of unread date dividers within a topic;
this could lead to the dividers incorrectly appearing on top of the
compose box.

We don't have other elements that can overlap with compose with a
z-index between 2 and 4, so just increase it to 4.
2022-11-16 11:01:09 -08:00
Sahil Batra e67fc9a713 compose_validate: Remove comments for stream-admin related code.
This commit removes comments related to stream-admin option from
wildcard_mention_allowed.

We have already removed stream-admin option from wildcard mention
policy setting in 83383090f9 since we are no longer planning to
implement stream admin feature and instead are working on new
permissions model based on user groups.
2022-11-16 09:36:56 -08:00
Rohitt Vashishtha 103b8f6de3 typeahead: Patch third/typeahead.js for IME event handling.
We do not want to import any of our modules into this file, so
it has an independent implementation of the fix for #22062. Also,
using -13 as a keyCode helps avoid having to make changes to all
the comparisons with e.keyCode that the module relies on.
2022-11-15 17:41:15 -08:00
Hari Prashant Bhimaraju 5346de9164 circleci: Rewrite integration to support the new webhook format.
CircleCI has updated its webhook format[1] for CircleCI Cloud,
Server version 3.x and 4.x. This commit rewrites the CircleCI
integration to parse the new webhook structure. The tests have also
been rewritten for the new format.

With this commit, we support webhooks from projects that use GitHub,
BitBucket and GitLab as VCS providers. The CircleCI integration doc
has been updated to mention the same. The doc has also been updated
with the latest instructions for configuring a webhook on the CircleCI
interface, and the new output screenshots.

References:
[1]: https://circleci.com/docs/webhooks
2022-11-15 10:45:05 -08:00
Rohitt Vashishtha 7e883add5b dark_theme: Re-render realm-logo on prefers-color-scheme changes.
We already re-rendered the realm-logo when the user selects either
the light or dark color scheme, but on `color-scheme-automatic`,
we didn't have any event handlers to trigger a render. This commit
adds a handler to listen for changes to `prefers-color-scheme` property.

Fixes #23548.
2022-11-15 10:35:31 -08:00
Sahil Batra f772eeddd6 util: Add call_function_periodically helper function.
This commit adds call_function_periodically helper function
which will be used to call functions periodically using
setTimeout. Currently, this new function is used to send
presence requests and trying reload.
2022-11-15 10:23:32 -08:00
Sahil Batra 5ce7015cc8 reload: Replace setInterval with setTimeout.
We retry reloading repeatedly at an interval of 30 seconds,
to handle the case where window.location.reload has no
immediate affect.

Previously, setInterval was used for this, but this commit
replaces it with nested setTimeout calls.

This change will help us in avoiding a large number of
requests to `/` in case when browser tries to "catch up"
pending calls after unsuspend.
2022-11-15 10:23:32 -08:00
Anders Kaseorg 1e84edf4f2 message_flags: Avoid relying on redundant messages list in response.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-14 16:00:54 -08:00
Anders Kaseorg c7fefab05d stream_create: Fix “susbscribing” typo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-14 15:28:30 -08:00
Tim Abbott 23856433e4 popovers: Fix styling of user card/profile status dots.
The tweaks I made as part of merging
f204a4c592 apparently were wrong; the
CSS class .popover_user_presence had been shared between both the user
card and the profile.

Fix this by referencing the right CSS classes. Additionally, fix the
margins to have a square hover region around the presence dot.

Fixes #23588.
2022-11-14 13:03:53 -08:00
Aman Agrawal 1365cc2263 hotkey: Handle `enter` keypress on `body` for recent topics.
This fixes a bug where pressing `enter` on a topic in recent
topics opens the compose box instead of narrowing to the topic.
2022-11-14 12:53:15 -08:00
Sahil Batra a0965d7335 activity: Use setTimeout instead of setInterval.
Instead of using setInterval to call send_presence_to_server
repeatedly, we now simluate setInterval using setTimeout.

This change helps us to avoid the condition likely related to resume
from suspend, when the browser tries to catch up by running a large
number of "missed" copies of the setInterval hook, causing the server
to rate-limit the client.

Fixes #23438.
2022-11-14 12:37:14 -08:00
Aman Agrawal fbe9a9e539 left_side_userlist: Remove feature from frontend.
Fixes #23517.

While this feature was added to Zulip very early, it has been troubled
for most of that time; it never looked great visually, had a lot of
implementation complexity around resize.js, and has a weird model (a
setting that changes the UI only in certain window sizes).

This option is not commonly used; while a significant portion of users
have it enabled, many of them just don't use window sizes where it
actually has an effect. So it's not clear that it will be missed if
removed; we got very few bug reports when it was completely broken for
a few days after we first integrated the new left sidebar private
messages design.

Even with it no longer being broken, it does not work very well with
the addition of the new PMs section in the left sidebar. (Having two
scrollbars in the sidebar looks quite awkward.) The new private
messages section in the left sidebar also addresses some of the use
cases for always keeping the Users list always visible, even in narrow
windows.

This option is only removed from frontend for now. To make this
decision easily reversible, the backend code of this feature
is still kept.
2022-11-14 12:23:55 -08:00
Aman Agrawal 2b0a4aad50 resize: Remove unused `h` parameter. 2022-11-14 12:18:24 -08:00
Aman Agrawal 91b2ecac45 ui_init: Remove dead code.
`right-userlist` isn't used anywhere in the code.
2022-11-14 12:18:24 -08:00
Lauryn Menard de12500f68 popovers: Rename "full profile" to "profile".
Now that we now longer have another thing called a "user profile", we
can simplify the name for this part of the UI.

Fixes #23530.
2022-11-14 12:16:22 -08:00
Lauryn Menard 48e2482bbd popovers: Rename "profile summary" to "user card".
This is a briefer and more intuitive name for this frequently accessed
part of the Zulip UI.
2022-11-14 12:15:54 -08:00
Taiki a09014f1de modals: Fix modal buttons in Safari for some users.
Some Safari users users observed an issue where these modal buttons
appeared with an ugly white-on-grey format. Removing the CSS line with
`appearance: button` appears to fix this for affected users.

That line seems unlikely to have been constructive; as documented in
https://developer.mozilla.org/en-US/docs/Web/CSS/appearance, this is a
deprecated value equivalent to `auto`, and a bit of a misfeature.

Additionally, the "Log in" button was incorrectly underlined on hover;
override that style.
2022-11-14 11:08:55 -08:00
Aman Agrawal b563fdc537 css: Fix hidden unread marker when a user mentioned message is focused.
Increase z-index of unread-marker to always appear above the message and
focused outline. Also, z-index of date_row is increased to hide
unread marker for it in special conditions.
2022-11-14 09:46:44 -08:00
Sahil Batra d35e482ddc modals: Don't close the modals on selecting something inside the modal.
Modals are closed when selecting something inside the modal if mouse
is dragged outside the modal. This happens as leaving the mouse after
dragging it outside the modal induces a click even outside the modal
and the current behavior is to close the modal on clicking outside it.

We remove the "data-micromodal-close" attribute from "modal__overlay"
element which is responsible for closing the modal. And we add
click handler which closes the modal on clicking outside the modal but
does not closes it when the mouse is dragged outside while selecting
something.

Fixes #23350.
2022-11-14 09:08:39 -08:00
Imran 0e0a910304
settings_user: Change audio to audible in settings. (#23518)
The notifications headings were not consistent between the personal stream settings panel
and /help/desktop-notifications.

This changes notifications headings from "Audio" to "Audible", since that seems like the
better choice of word.

Fixes #23515.
2022-11-10 16:18:56 -08:00
Tim Abbott 1ca4566eb2 compose: Use text-area-edit for syntax replacements.
Fixes #23284
The basic approach used by `text-area-edit` is same as we were
using, so there is no real change. There are some nice checks
in `text-area-edit` which we don't do that helps us avoid
common bugs.
2022-11-10 16:15:33 -08:00
Sahil Batra 6ad8e276de settings: Refactor code for realm message retention setting.
This commit refactors the code for realm message retention
setting to make it more similar to code for other time-limit
realm settings. There are still separate functions for the
message retention setting but they are similar to that of
other time-limit settings and can probably help us to
deduplicate the code in future. This refactor also helps
us in reusing some code for stream message retention
setting for changes in #23013.

This commit also fixes a bug where save-discard widget
not being hidden when resetting the setting to original
value. This can only be reproduced when the original
setting value is "retain_forever".

Following changes have been done in this commit -

- Added data-setting-widget-type attribute which is set to
"message-retention-setting" similar to "time-limit" value for
message edit and delete limit settings.

- Added get_message_retention_setting_value function similar
to get_time_limit_setting_value function which is used by
get_input_element_value.

- Removed "message-retention" block from
get_complete_data_for_subsection and the message retention
setting is now added to request data in populate_data_for_request
itself using data-setting-widget-type attribute.

- Updated id and class of elements to support the above changes.
2022-11-10 16:13:49 -08:00
Sahil Batra 73e247f08c settings_org: Fix save-discard not hidden for "Other settings" section.
When resetting a setting in "Other settings" section to its original
value, the save-discard widget for the section is not hidden. This can
be reproduced when no language is set for code-block default language
setting. This was because check_property_changed incorrectly returned
true as the original value for code-block language setting was null
but the widget element returned empty string.
2022-11-10 16:13:49 -08:00
Riken Shah 51870f86da recent_topics: Show user status emoji in PMs messages.
To implement this, we are rendering users in PMs with
the status icon (via `user_with_status_icon.hbs`) and
then passing rendered HTML to the recent topics row.

Fixes #23262
2022-11-10 12:32:08 -08:00
Riken Shah 9d12a9c21e recent_topics: Show user presence status in PMs messages.
We have bound the `mouseenter` event with a circle
status parent element to render the tooltip. Instead of passing
the tooltip content directly in `data-tippy-content`, we
are rendering it via JS because when showing the bot
tooltip we want a multiline tooltip.

We have also made some minor changes to `do_render_buddy_list_tooltip`,
so we can append the tooltip to the target element and avoid adding
a observer to it.

This commit also sets the font weight for tippy content to
400 to avoid bold content.
2022-11-10 12:32:08 -08:00
Aman Agrawal 6e3d8c7733 recent_topics_row: Let pm status icons have its own class.
Some additional changes to make align them correctly after
the assigning the new class.
2022-11-10 12:32:08 -08:00
Lauryn Menard f0c71a0293 unread-ops: Add check to make `mark_as_read_turned_off_banner` visible.
When processing an "update_message_flags" event to mark messages
as unread, check the current message list once messages are updated
to see if the `mark_as_read_turned_off_banner` should be visible.

This means that other clients in a view that also does not mark
messages as read (for example a sender or keyword search narrow)
will also load the banner when the view is updated.

Fixes #23502.
2022-11-10 12:07:02 -08:00
Sayam Samal f204a4c592 user_profile_modal: Move presence activity status to modal header.
Moving the last active status icon to the modal header, we obtain a
cleaner visual design for the user profile modal which is more
consistent with other parts of UI.
2022-11-10 12:03:59 -08:00
Alya Abbott 52a04b53ad help center: Clean up "Deactivate or reactivate a user" help page.
Also, removes now unused image in `/static/images/help`:
`deactivate-user-email.png`.

Fixes #23503.
2022-11-10 12:00:25 -08:00
Rixant Rokaha dd39a9747d left_sidebar: Hide stream section separator when there is only one.
Showing section separators in the left sidebar ("Pinned streams",
"Active streams", etc.) is unnecessary when there is only one section,
and can feel confusing. We should show the separators only when there
is more than one section present.

Fixes #22843.
2022-11-09 17:34:58 -08:00
Tim Abbott 9074a164e6 resize: Adjust left_side_userlist sizes when showing sidebar.
This fixes a race in certain intermediate sizes, with the
left_side_userlist setting, the sidebar sizes would have been computed
with invalid information about the size of the two regions to divide
space between (because the sidebar was closed when the calculation was
done).
2022-11-09 16:55:19 -08:00
Tim Abbott 56005da39d popovers: Simplify sidebar hiding logic for user menus.
Structurally, the goal of this logic is to just hide all popovers
(including potential user popovers) and not the sidebars; use the
function designed for that purpose rather than hackily
hand-implementing it.
2022-11-09 16:55:19 -08:00
Tim Abbott 87bc18c2be popovers: Don't close user list sidebar opening left sidebar menus.
In window width ranges where the left sidebar is fully open and the
right sidebar is toggleable, the existing logic to hide all popovers
and then reopen the left sidebar stream list.

We have a function designed to close all popovers that aren't
sidebars; we should just use it.

See 2d414fa897 for a previous incomplete
fix for this issue.
2022-11-09 16:55:19 -08:00
Aman Agrawal 7dbd2f74d9 resize: Simplify code to calculate max height of left sidebar blocks.
The `size_blocks` code was cool looking but wasn't working well.
Since we only have to place streams list and users list, we can
fix their `max-height` more easily without trying to solve the
`multi-block` case which `size_blocks` was trying to do.

This also fixes users list max-height being incorrectly set,
resulting in user unable to scroll to some user list items.
2022-11-09 16:55:19 -08:00
David Rosa 47a8eb0b66 help center: Document viewing @-mentions.
Adds "View your mentions" page to document how to access @-mentions
and the @ indicator for unread @-mentions on desktop/web and mobile.

Fixes #23422.

Co-authored-by: Alya Abbott <alya@zulip.com>
2022-11-09 15:51:44 -08:00
Tim Abbott c22de76af7 settings: Fix reuse of .stream-row class name.
The stream-specific notifications table incorrectly used the
.stream-row CSS class. As a result, live-update code for the "stream
settings" UI when changing a stream's permissions model would
incorrectly replace rows of this table with a "Manage streams" style
row.
2022-11-09 15:30:03 -08:00
Aman Agrawal d15b29f056 list_widget: Add functions to add and remove a rendered item in the list.
This a refactoring commit as a followup from #23385.
2022-11-08 13:27:48 -08:00
Aman Agrawal 8e9ae426c0 recent_topics_ui: Add a comment regarding finding if the topic is rendered. 2022-11-08 13:27:48 -08:00
Aman Agrawal 542aea4b1c left_sidebar: Remove `chevron-left` from back to streams.
This will help us make `Back to streams` look better with PMs header.
2022-11-08 13:25:42 -08:00
Aman Agrawal 46967002dd left_sidebar: Show PM section in topics zoomed view.
This is important to preserve the invariant that the unread count for
private messages is always visible.

Fixes #23391.
2022-11-08 13:25:09 -08:00
Aman Agrawal 1b304c5296 left_sidebar: Match color of `show-all-streams` to other headers.
Specifically trying to match the color to PMs header.
2022-11-08 13:24:11 -08:00
Aman Agrawal fc7ec5d8f9 left_sidebar: Left align show all streams with other buttons.
This includes a slight color change to `show-all-streams` to
match with the other headers.
2022-11-08 13:24:11 -08:00
Aman Agrawal 1192488240 left_sidebar: Left align all the section headers with the icons. 2022-11-08 13:24:11 -08:00
Aman Agrawal 41a60f84b9 left_sidebar: Correctly align user status icon.
Align the user status icons with the other icons in the left
sidebar so that their center falls in the same vertical line.
2022-11-08 13:24:11 -08:00
PALASH BADERIA 343e15a23d
settings: Link to relevant help center articles in notification settings.
This provides a hook for users to get to these /help/ pages, which contain
details on exactly how these notifications/settings work, as well as
troubleshooting advice.

Fixes: #23369.
2022-11-08 11:12:19 -08:00
Lauryn Menard aac76bb185 narrow-banner: Update empty title for "pm-with" multiple users.
Instead of using "these people", we use "these users".

Note that the "pm-with" single user case has already been updated
to show the user's full name instead of "this person".
2022-11-08 11:07:38 -08:00
Javier González 63355c2a34 popovers: Add bottom margin to input.
Fixes: #23114
2022-11-07 11:31:37 -08:00
m-e-l-u-h-a-n 06f0634ca5 css: Fix height issue for stream and user group creation forms.
Due to incorrect heights set for user-group creation and stream
creation body we had a UI bug because of which bottom part of
user group and stream creation forms were slightly visible
through the bottom.

It was due to somewhat fussy css height rules and incorrect
height calculations for that UI.
2022-11-06 22:02:41 -08:00
Aman Agrawal 244be5b71b resize: Increase minimum height for left sidebar blocks.
This function is only called to calculate the size of stream and
user list. Using 250px as minimum height for these blocks gives
them enough space to be usable regardless of their height ratio.
2022-11-05 15:15:44 -07:00
Aman Agrawal b6a9819395 resize: Update buddy list height when resizing streams list.
If the buddy list is displayed in the left sidebar, height of
both these blocks needs to be changed to accommodate for the
changes.

The fixes the bug that stream list and user list don't fill
left sidebar and have 80px height regardless of viewport height.
2022-11-05 15:15:42 -07:00
Aman Agrawal b8f7293dba resize: Use scroll element get the scroll height for streams.
Since streams and PMS now use left_sidebar_scroll_container
for scrolling, use it get the correct scroll height.
2022-11-05 15:15:25 -07:00
Lauryn Menard cba8738eea search: Check if user can access stream topics before fetching history.
When building search suggestions for stream topics, instead of
assuming that the user has access to the stream's topic history
from the server, we check whether the user has access to the
stream's topics.
2022-11-05 15:09:49 -07:00
Lauryn Menard f17030a802 compose-validate: Use settings config value for policy check.
Updates the check in compose validate for the organization's
policy on sending private messages to use the code/value in
settings_config, instead of the number value.
2022-11-04 14:37:45 -07:00
Lauryn Menard 6b4ab21562 narrow-banner: Exclude bots when checking org sending pms policy.
Private messages between a user and a bot are not restricted by
the organization's policy setting for sending private messages.
So, for the empty banner text, we set the default title for
a single bot for the "pm-with" narrow.

Group private messages that include a bot are restricted by
this policy setting, so those messages stay the same.

Also, since bot's aren't people, we update the text for valid
"pm-with", "sender" and "group-pm-with" operands to include the
user's full name in the title.

When there are multiple people in the "pm-with" narrow, we still
send a generic "these people" message instead of listing all the
users in the narrow.

Finally, we make the default message end in a period instead of
an exclamation mark.
2022-11-04 14:37:45 -07:00
Lauryn Menard f06143bc7c narrow-banner: Check private message policy for empty narrow title.
For narrows that focus on private messages ("is:private", "pm-with",
"group-pm-with"), we want to check the organization private message
policy and set an empty narrow title that matches that policy.

For these narrows with invalid users, we prioritize that message
for the empty narrow title, instead of the private message policy
message.

Fixes #21889.
2022-11-04 14:37:45 -07:00
Julia Bichler 16bed8ef42 stream settings: Hide email portion if unsubscribed.
This hides the stream email portion in the general settings
if the user is not subscribed to the stream.

Fixes part of #19519.
2022-11-04 14:22:27 -07:00
Julia Bichler 74f2d8ca7f stream settings: Allow modifying of email address.
This allows the user to modify the stream email address
by adding or removing tags before copying.

Fixes part of #19519.
2022-11-04 14:22:27 -07:00
Julia Bichler 6e163bb042 stream settings: Add copy email address modal.
This moves the stream email address to a modal
and adds a copy button.

Fixes part of #19519.
2022-11-04 14:22:27 -07:00
Lauryn Menard 54ad2f5266 compose-actions: Stop compose box load for invalid users with any trigger.
A user could trigger a "pm-with" narrow with an invalid user by moving
back/forward in the session, which would trigger the compose box to
open via a hash change. Updates the check to pass in any "pm-with"
narrow with an invalid user.

Also, if the compose box was active/started in the previous view, but
without any content, then we want to actively cancel/close it in the
invalid user "pm-with" narrow.
2022-11-04 14:08:25 -07:00
Lauryn Menard 09c4e2f662 compose-actions: Load compose box for PMs based on org policy.
If an organization has disabled sending private messages, we do not
want to load the compose box automatically for "pm-with" narrows.

We still open the compose box for private messages narrows with a
single bot user as this is not limited by this organization setting.

Also, if the compose box was active/started in a narrow with a bot
user, but had no content, then we want to close/cancel that in a
new narrow with a person or group.
2022-11-04 14:08:25 -07:00
Aman Agrawal 836db701aa recent: Fix cursor position after muting a topic above a PM row.
Fixes #23332

Check if col we are trying to focus exists for the row inside
`set_table_focus`.

We call `revive_current_focus` after `topics_widget` is defined
since it can be used inside it.
2022-11-04 13:59:22 -07:00
Aman Agrawal 4bd46f1cb4 recent: Simplify down arrow navigation.
Fixes #23331

Combine checks for last row between `vim_dowm` and `down_arrow`.

Check for the presence of unread counter in `set_table_focus`
directly so that it can be used in other cases as well. This is
especially useful when marking the last row in the table as read.
2022-11-04 13:59:22 -07:00
Aman Agrawal c41c94e36e recent_topics: Improve behaviour of inplace rerender.
We used to hide and show topic rows in the DOM when topics are
updated. This resulted in incorrect calculations in the length of
visible topics. As a consequence, focus is sometimes set to hidden topic.
Removing hidden topics from DOM helps us keep
the calculations correct.

The fixes bugs related to focus being lost when trying to mute
or mark as read the last row.
2022-11-04 13:59:20 -07:00
Aman Agrawal ef067eafad topic_list: Move topic filter out of topics list `ul`.
Instead of topic filter box being a part of the list when keeps
updating, we move it out and fix its position.

This should reduce rendering time of topics list and provide
a smoother experience to users when waiting for topics list to
load.
2022-11-04 13:40:46 -07:00
Anders Kaseorg 3a718d786f js: Fix type issue with FormatJS rich text elements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 14:48:40 -07:00
Anders Kaseorg b582d5886c stylelint: Fix import-notation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 14:48:40 -07:00
evykassirer 6ef5736bfe drafts: Rename undefined draft topics to empty string.
This fixes an error state that came out of #22094.
The code causing the error was fixed in #23238 but some
drafts still have undefined topics which has some strange
side effects. One day we'll have typescript help catch
this kind of thing!

More details on CZO: https://chat.zulip.org/#narrow/stream/9-issues/topic/live.20update.20issue.20with.20drafts/near/1457913
2022-11-02 16:36:36 -07:00
evykassirer 919f08d80f drafts: Catch and log error caused by drafts with undefined topics.
This is a bandaid fix to an error that came out of #22094.
The error was fixed in #23238 but some drafts still have
undefined topics which is raising this error.

More details on CZO: https://chat.zulip.org/#narrow/stream/9-issues/topic/live.20update.20issue.20with.20drafts/near/1457913
2022-11-02 16:20:40 -07:00
Imran 1fadb7cbd9
stream_settings: Link to stream description help center article.
This lets us provide a hook to where we've written some advice both on
what makes a good stream description, and also what Markdown formatting
is supported there.

Fixes #23376.
2022-11-02 16:19:53 -07:00
Rohitt Vashishtha 1db901cded keydown_util: Check Enter events properly for IME edge cases.
We now check whether an IME is currently composing and do not
process any such key==="Enter" events as the Enter/Return key.

Fixes #22062.
2022-11-02 15:42:42 -07:00
Rohitt Vashishtha 56970ee117 message_edit: Refactor message edit keydown handler.
This commit modifies handle_message_row_edit_keydown to use
keydown_util.is_enter_event(). This is a precursor to fixing #22062.
2022-11-02 15:05:33 -07:00
Rohitt Vashishtha 836f0fed10 message_edit: Refactor topic edit keydown handler.
This commit modifies handle_inline_topic_edit_keydown to use
keydown_util.is_enter_event(). This is a precursor to fixing #22062.
2022-11-02 15:05:33 -07:00
Rohitt Vashishtha d4379f9528 keydown_util: Extract all 'Enter' events to one place.
This is a prep commit to fix #22062.
2022-11-02 15:05:33 -07:00
Chris Bobbe b52e83281b shared: Bump version to 0.0.16 2022-11-02 13:59:05 -07:00
Mateusz Mandera 6e336ef6f6 delete_topic: Use the same timeout pattern as /mark_all_as_read.
We don't want to use the nginx 502 timeout as an API pattern. In
/mark_all_as_read we've already figured out how we want to handle this
instead.
2022-11-02 16:50:06 -04:00
Lauryn Menard 66da42bbae popovers: Do not show option to mark unread for unsubscribed streams.
In the message actions popover menu, adds an additional check for
whether the mark as unread option should be displayed based on if
the message is a stream message and if the user is subscribed to
the message's stream.
2022-11-02 13:39:20 -07:00
Tim Abbott a1aba2869b settings_org: Fix exception processing stream type events.
The previous check looked at whether the settings overlay as a whole
was open, not whether the specific panel we're going to update was
rendered.

The other code paths calling from server_events_dispatch into this
module already correctly check meta.loaded.
2022-11-02 11:43:07 -07:00
Ganesh Pawar 3a9730b7c6 gear_menu: Change sponsored plan name. 2022-11-02 09:55:23 -07:00
Tim Abbott 3ea1311f56 unread: Downgrade unread race logging to not an error.
We added this logging statement in
8d33a62eca, and we now have the data to
suggest this will happen in normal operation.

I left this as a blueslip.log, since it may be useful to see in the
leadup to another exception.
2022-11-01 22:47:52 -07:00
Aman Agrawal 8dd3579885 unread: Use `unread_topic_counter` to get message details.
The message we are trying to remove from unread mentions might not
have been fetched locally.

Fortunately, the `unread_topic_counter` data structure is designed to
support exactly this kind of lookup.
2022-11-01 22:41:07 -07:00
Aman Agrawal 2e480b0b09 unread: Move some functions.
Moved these functions to be able to access `unread_topic_counter`
inside them.
2022-11-01 22:32:07 -07:00
Greg Price 8810203a4c shared: Prescribe atomic push when bumping version.
This way, if the maintainer isn't able to update `main`,
the push doesn't add the shared-VERSION tag either.
That avoids ending up with a tag that potentially doesn't
get included in the history of the main branch.

The Git docs warn that servers might or might not support this
feature, but GitHub does -- indeed they boasted about it when it
first came out, in Git 2.4 back in 2015:
  https://github.blog/2015-04-30-git-2-4-atomic-pushes-push-to-deploy-and-more/
2022-11-01 22:25:37 -07:00
Chris Bobbe 167b891d4e shared: Fix typeahead.js.flow to add Emoji['reaction_type'].
The emoji matcher uses this property in is_unicode_emoji.

It doesn't quite make sense to be talking about "reaction types"
here -- we might use this for a message-reactions UI, but we might
just as reasonably use it for emoji UI in message composing. Ah,
well: I guess that's just a bit of messiness that we can deal with.
2022-11-01 17:46:47 -07:00
Chris Bobbe 72303bc0b0 shared: Bump version to 0.0.15 2022-11-01 10:19:34 -07:00
Lauryn Menard 7b88d6d8f8 help-menu: Update tip at the bottom of search operators tab.
Updates the tip at the bottom of the search operators tab to only
state that operators can be combined as needed.

Fixes #22866.
2022-11-01 08:40:33 -07:00
Aman Agrawal 6042e91fe8 left_sidebar: Hide sub to more streams in topics list view (zoom-in). 2022-11-01 08:24:24 -07:00
Aman Agrawal 7e8ebe3aa5 recent: Fix alignment of unread mention icon. 2022-11-01 08:24:24 -07:00
Lauryn Menard af00fd05b2 narrow-banner: Check user exists with "group-pm-with" empty narrow.
When "group-pm-with" is the first operator and setting an empty
narrow banner, check that the operand matches a user and set the
title based on whether the user exists or not.
2022-11-01 08:23:43 -07:00
Lauryn Menard a2e4005279 narrow: Return default search title for "group-pm-with" operator.
Because "group-pm-with" is not a common search operator, instead of
setting a specialized title in the browser and tab, just use the
default title, "Search results".
2022-11-01 08:23:43 -07:00
Lauryn Menard 656f2c6f5f images: Move operating system screenshots to app-screenshots directory.
Moves the three images of the web-app on different operating
systems (Mac, Ubuntu and Windows) to the same directory as
the two mobile-app screenshots, `/static/images/app-screenshots/`.
All five images are referenced in `static/js/landing-page.js`.
2022-10-31 14:36:54 -07:00
Lauryn Menard 0c947985bd tests: Update tests to use example profile picture.
So that we can stop using Tim's photo for tests, adds an open
license profile picture to use instead.

Updates tests that used `tim.png` to use the new example profile
picture, which is located in `static/images/test-images/avatars/`.
2022-10-31 14:36:54 -07:00
Lauryn Menard 1eda42f509 images: Create `/authentication_backends` directory for icons.
Creates `static/images/authentication_backends` directory for icons
of backend authentication methods, which are used on the log-in page.

And updates the example documentation in the API `/server_settings`
endpoint.
2022-10-31 14:36:54 -07:00
Aman Agrawal 784966b3bd css: Visual fixes to message feed notice.
Fixes #23273

Removed height restriction to allow the box to grow when text wraps
to the next line.

Aligned wrapped lines to the text in the first line instead of the
icon.
2022-10-31 14:33:50 -07:00
Aman Agrawal 42ff193e29 recent: Fix alignment of unread count in PM rows.
The alignment was off in both narrow and wide screens. Added
an invisible mute icon to PM rows to keep the unread counts aligned
with topic rows.
2022-10-31 14:21:24 -07:00
Aman Agrawal d6c68ac82c css: Increase opacity of sidebar titles in dark theme.
0.5 opacity felt too light; it made these appear similar in color to
muted streams, not as the intended grey text.  This opacity reduction
is only applied in dark theme to sidebar titles.
2022-10-31 14:17:40 -07:00
Greg Price 28c97dd4f1 typeahead [nfc]: Dedupe query_matches_person logic a bit.
I think this makes the flow a bit clearer: we always search
`.full_name`, and if emails are real then we also search the email.
2022-10-31 10:28:03 -07:00
Greg Price 728555522b typeahead [nfc]: Use people.get_visible_email abstraction.
Best to centralize this logic -- makes the intention clearer at the
use site, and also puts us in better position to make changes to it in
the future.
2022-10-31 10:28:03 -07:00
Greg Price c746d5669f typeahead [nfc]: Dissolve `query_matches_source_attrs`.
This makes each of the call sites more straightforward and
transparent.  In `query_matches_person` it also opens up further
simplifications, which we'll make next.

Since we're now exporting `query_matches_string` from this
shared module, we write its type in the `.js.flow` file.
2022-10-31 10:28:03 -07:00
Greg Price 7400165031 typeahead [nfc]: Push toLowerCase down into query_matches_string.
This prepares us to dissolve query_matches_source_attrs in favor
of making its call sites simpler and more transparent.
2022-10-31 10:28:03 -07:00
Aman Agrawal 925fa4ca50 left_sidebar: Make topics list header sticky.
Fixes #22911

`Back to streams`, stream name and filter topics are all sticky
now and their color changes based on which filter is active and
the currently applied theme.
2022-10-28 17:43:33 -07:00
Lauryn Menard 8ccd416e3b filter: Combine stream narrow cases in `filter.get_title`. 2022-10-28 17:41:47 -07:00
Lauryn Menard 0901ccdb47 filter: Show pm_with title with near narrow links.
Updates the `filter.get_title` logic to return the list of users
for narrows that include the pm_with and near operators. That way
the browser/tab title remains the same for these views.
2022-10-28 17:41:47 -07:00
Mateusz Mandera a410f6b241 do_mark_all_as_read: Split up the work into batches.
Fixes #15403.
2022-10-27 16:59:54 -07:00
aparna-bhatt 5189826f27 css: Improve the dialog_widget loading spinner visuals.
Previously, when you clicked the confirmation button in a
dialog_widget, we'd display a loading spinner on top of an ugly grey
button background.

Remove the ugly grey background color, while making sure the loading
spinner inside the button looks good and doesn't resize the button.

Fixes: #22002
2022-10-27 16:29:22 -07:00
Zixuan James Li 6f4047c679 unread: Extract old_unreads_missing.
This avoids post-initialization access to page_params inside unread.js.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-10-27 14:59:16 -07:00
Zixuan James Li 79b8219797 unread: Pop unread_msgs from page_params for initialization.
This change is made so that we are not accessing the global page_params
directly. Note that we also rename unread_msgs to params to match other
modules that follow this pattern.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-10-27 13:03:54 -07:00
Zixuan James Li b9f7edb58a unread: Stop accessing page_param.unread_msgs after init.
This adds a get_unread_message_count helper that returns the size of
unread_messages and replaces the usage of page_param.unread_msgs.count
elsewhere in the codebase.

Fixes #23334.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-10-27 13:03:54 -07:00
Tim Abbott d47f29c2d6 reactions: Implement display_emoji_reaction_users setting.
This setting provides a more ergonomic experience when viewing a
message where only a small number of emoji reactions are present; you
no longer need to hover over the reaction to see who reacted, which is
often quite important to understanding what it means.

We added this setting (visible in the development environment only,
and implemented on mobile) a few months ago; so to complete this
feature, we just need to add the frontend rendering/live update logic
and publish it.

As documented in the code comments, the current rule is "messages with
3 or fewer reactions" for which messages will display the names of the
users reacting.

The previous set_reaction_count API made sense when the display of a
given reaction was a pure function of its data. However, we will soon
be making it a function of the total number of reactions on the
message.

Thus, view functions to update reaction display now need to call a
shared update_vote_text_on_message function in all code paths, even
code paths like "add the first vote for a reaction" and "remove the
sole vote of a reaction" which previously did not need to call
set_reaction_count.

Fixes #20890.
2022-10-27 12:41:51 -07:00
Tim Abbott 98c478d994 reactions: Pass full message objects to view functions.
This is not the cleanest API, but it will be necessary in the next
commit in order to update the message's rendering of other emoji.
2022-10-27 12:41:51 -07:00
Tim Abbott 02b670fa66 reactions: Use clean_reaction_object API for view functions.
This substantially reduces the complexity of parameter passing in the
reactions rendering code path.
2022-10-27 12:41:51 -07:00
Tim Abbott b346e492c8 reactions: Reorder make_clean_reaction. 2022-10-27 12:41:51 -07:00
Tim Abbott 545a31e0b1 reactions: Delete stale message.reactions after cleaning.
Also update some comments explaining the core data model and approach
for set_clean_reactions.
2022-10-27 12:41:51 -07:00
Tim Abbott 5bd074bb36 reactions: Use a better variable name for clean_reactions objects.
We may want to rename clean_reactions to something else, but the name
`r` is pretty confusing for an object that isn't a single reaction,
but instead an object detailing all the reactions on a message.
2022-10-27 12:41:51 -07:00
Raghav Luthra a8fc195402 reactions: Change color of reaction counter from blue to black.
The blue font color on the vote_text beside the reactions in
light mode made it seem like a link which it's not, so it has
been changed to regular font color.

We preserve the blue font color on hover, matching the add-reaction
button.
2022-10-27 12:41:51 -07:00
Raghav Luthra 477a1b5789 reactions: Refactor CSS to prepare for longer vote_text.
This fixes a bug where in narrow windows, long vote_text could extend
beyond the body of the reaction's allocated area.

It also provides a matching right margin around the count/name inside
the reaction pill, which looks better when we have strings inside them.
2022-10-27 12:41:51 -07:00
Raghav Luthra 1b75151a97 settings: Fix display_emoji_reaction_users org setting save/discard.
Follow-up to commit 22a5d008c1.

The new display setting introduced in above commit was not registered
properly and enabling/disabling it from Organization settings > Default
user settings did not display a "Save/Discard" widget. This has been
fixed by modifying the `settings_org.get_subsection_property_elements`
function.
2022-10-27 12:41:51 -07:00
Aman Agrawal b23931bd66 recent: Fix unread counts wrappings to next line in long topic names.
We limit the word break to only text present inside the `a` tags
so that it doesn't apply to unread count.
2022-10-26 21:34:36 -07:00
Aman Agrawal 45f35a464e stream_list: Reduce stream header's height when scrolling elt into view.
Since stream header is now sticky, we need to reduce it's height
when calculation position of the element we want to scroll into view
so that it doesn't hide under the sticky header.
2022-10-26 13:47:08 -07:00
Aman Agrawal fc70921eeb scroll_util: Add support for sticky headers.
When calculating position of an element, we now take into account
the height of the sticky headers too.
2022-10-26 13:47:08 -07:00
Aman Agrawal 470553b457 left_sidebar: Fix some PMs not being displayed when PMs are zoomed in.
We added sticky headers above the PM list but forgot to subtract
it from the max-height of the scrollable container.
2022-10-26 13:47:08 -07:00
jai2201 6f9e97921d pm_section: Create collapsible private messages section.
This commit introduces the change of rendering private messages
section as collapsible, whose data-fetching logic came with zulip#21357.

We now have separated out `Private messages` from `top_left_corner`
section and shifted it below the `global_filters` in a different
separate section along with stream list with common scroll bar
in left-sidebar.

The new PM section will be opened by-default on loading the page
and will have a toggle-icon in its header, clicking on which makes the
section collapse/expand accordingly.

In default view, only recent 5 PM threads would be shown
and would append the active conversation as the 6th one at last
if not present in those 5, similar to how topics list work.

In PM section with unreads, a maximum of 8 conversations
would be shown and rest of them would be hidden behind
the 'more conversations' li-item, clicking on which takes
to the zoomedIn view of PM section where all the present
PM threads would be visible and rest of the sections of left-sidebar
will get collapsed.

Fixes #20870.

Co-authored-by: Aman Agrawal <amanagr@zulip.com>
2022-10-26 13:47:08 -07:00
Barissa-Imran 15b9e9c7cc bots: Customize reactivation confirmation modal for bots.
Since bots can't join user groups, and end users don't think of bots
as a special class of users, it's worth having special text here.

Fixes: #23270.
2022-10-26 13:26:16 -07:00
Rebecca Södereng 5814b61f00 popovers: Drop text for historical messages from three-dot menu.
Dropped text "(Message sent when you were not subscribed)" for
historical messages in the three-dot message menu.

This information was already available via the "You subscribed" type
divider lines, which were added about the same time back in 2013, and
this text feels somewhat ugly.

Also removed the historical field from the args object that is
passed to the template, as this is not used anymore.

Fixes #23198.
2022-10-26 13:20:37 -07:00
Lauryn Menard 7172a6ef13 filter: Show stream and topic title for near link narrows.
Updates the `filter.get_title` logic to return the stream name for
narrows that include the stream, topic and near operators. That
way the browser/tab title remains the same for these views, which
have a particular scroll offset.
2022-10-26 12:35:28 -07:00
Aman Agrawal ca36f23d9f recent_topics: Fix long topic and stream words squeezing other rows.
Topics and streams containing long words can cause horizontal
overflow and squeeze other columns too much.
2022-10-26 12:28:58 -07:00
Lauryn Menard 95aa9a4f83 compose-box: Remove reset max-height calculation for preview click.
Removes call to reset_compose_message_max_height when clicking on
the markdown preview button, which due to the `#compose` div element
momentarily shrinking to be empty, caused the calculation of the
max-height to grow larger on each click.

Also refactors reset_compose_message_max_height to use the height
from `getBoundingClientRect`, which defaults to zero when empty.

And fixes a small discrepancy in how max-height is applied to
a div element vs a textarea element, so that the visible height
doesn't change between the preview and write modes in the compose
box.

Fixes #23277.
2022-10-25 13:49:29 -07:00
Aman Agrawal 5ee78fc14c recent_topics: Don't process hotkeys in empty table.
The fixes errors when we are trying process user input before
anything is initialized in recent topics.
2022-10-25 11:07:26 -07:00
Aman Agrawal 2d31b52927 ui_init: Initialize hotkey handlers after other libraries are initialized.
This gives us some time to render and fetch data before allowing
user to start using hotkeys. It avoids error being thrown when
hotkeys are used when the app is still loading.
2022-10-25 11:07:26 -07:00
Lauryn Menard e66f125ee6 recent-topics: Update hash for view to be "#recent".
Updates the hash used for the recent conversations view to be
"#recent" instead of "#recent_topics".

We will need to keep the logic for handling "#recent_topics"
permanently because users potentially have messages from
Welcome Bot with links to that hash.

Including "recent_topics" as a web_public_allowed_hash in
hash_util.js can be changed once self-hosted servers cannot
upgrade directly to Zulip 5.x from the current version.

Fixes #23132.
2022-10-25 11:03:44 -07:00
Tim Abbott 530406e2ef resize: Don't call resize_page_components for new messages.
The resize handler is a somewhat expensive operation, which we'd like
to avoid when processing the receipt of new messages. It's also
unclear why it would be necesssary; bottom_whitespace is fixed in
size, and the sidebars.
2022-10-25 10:53:48 -07:00
Tim Abbott 8d33a62eca message_util: Avoid unnecessary unreads work processing new messages.
It should be very rare to discover new unread messages during a
message_fetch call. This can potentially happen due to races (fetching
just as a new message arrives), but it shouldn't be the common case.

Previously, we would trigger a full rerender of all UI displaying
unread messages every time a bulk message fetch operation returned
(including every time one narrowed), regardless of whether any actual
state had changed.

Fix this by actually checking if we discovered any new unread messages.
2022-10-25 10:53:48 -07:00
Tim Abbott 505a9119ba stream_popover: Remove unnecessary resize call.
There's no reason that opening left sidebar popovers should require
the app to recalculate the size of any of its components; popovers are
drawn on top of the rest of the UI in any case.

This appears to have been added in
9ed05a1f85 as part of prototyping the
left side user list feature.
2022-10-25 10:53:48 -07:00
Tim Abbott 20b357d8d9 popovers: Remove unused show_pm_list_sidebar.
This was likely introduced in error in
fd66d9f70336b2bdbbffb1bf13402516b9920682; it is a duplicate of
show_userlist_sidebar, which, in contrast is actually called.
2022-10-25 10:53:48 -07:00
Tim Abbott 5a83543418 stream_events: Use update_unread_counts API.
Because we can count on the unread.js data structures to be correct,
we no longer need this legacy code that tries to re-process all
messages the client has cached for whether any are present in the
target stream and marked as unread.

It's not clear we need this at all, since the current Zulip server
will mark all messages as read when unsubscribing from a stream, but
having this call protects us from future bugs should that behavior
change.

This cleanup also revealed a possible bug, where we would fail to
update global unread counts properly when unsubscribing from a stream
until the deferred_work queue processor sends us the
update_message_flags event associated with that change.
2022-10-25 10:53:48 -07:00
Tim Abbott 8265bb75cb stream_muting: Call the update_unread_counts directly.
The previous invocation message_util.do_unread_count_updates dates
from a time when `unread.js` did have any data beyond what full
message objects were present in the client, and thus we needed to
recalculate everything from those message objects when muting state
was changed.

With the modern unread.js data structures, all that's required is a
full recalculation/rerender via this function.
2022-10-25 10:53:48 -07:00
Sahil Batra b4eddad9a5 people: Use names in PM urls instead of emails.
We change the "pm-with" and "sender" narrow urls
to be of "{user-id}-{encoded_name}" form instead
of using email. This change improves performance
of changing between PM views since parseOneAddress
function was slow and we remove its usage now by
using name instead of email.

The name is encoded such that the characters that
would be encoded by the browsers are replaced by
"-".
2022-10-25 10:42:00 -07:00
Rishant Rokaha a9893fb654
settings: Add confirmation modal for reactivating a bot in personal settings.
There's already a similar modal in organization settings, so this improves 
the consistency of the UI.

Fixes #23281.
2022-10-25 10:39:16 -07:00
Tim Abbott 3d2a3f2593 popovers: Avoid focus outline on \vdots when actions popover is open.
Now that we show the \vdots icon while the actions popover is open,
there's a weird looking behavior where a focus outline appears around
the \vdots icon, only if you clicked on the icon itself, not its
square containing click arrow.

Disable this unintended behavior, which disrupts the otherwise
simulated state where focus is in the popover (but no row is focused).
2022-10-24 10:47:56 -07:00
Eyuel Berga Woldemichael 1e4e0a8155 message feed UI: Remove redundant color declaration.
The color for the message control buttons is set in the
`message_control_button` class. The `reaction_button_visible` class
also sets a color declaration with the same value.

This commit removes this declaration because it doesn't change the
color of the reaction icon(the class is currently only used in
conjunction with `message_control_button` to toggle the button
visibility) nor does it override any inherited  style (hover color
remains the same regardless) as it lacks an `!important` rule.
2022-10-24 10:29:23 -07:00
Eyuel Berga Woldemichael c8cfef0581 left-sidebar: Show the 3-dots icon when the menu is selected.
This commit fixes the issue where the 3-dots menu icons on the left
sidebar disappear even though the associated popover is open by
toggling a special CSS class on the menu item. It follows the same
approach used by the emoji picker on the message feed UI.

Fixes  #23157
2022-10-24 10:29:23 -07:00
Eyuel Berga Woldemichael 019ff29daf message feed: Show the 3-dots icon while actions popover is open.
This commit enables the 3-dot menu to be visible while the associated
actions popover is open using the fact that the 'has_actions_popover'
class is attached to the message with an open popover. This approach
solves the bug without any additional JavaScript code.

Fixes part of #23157
2022-10-24 10:29:23 -07:00
Aman Agrawal 12d42320ff recent_topics_ui: Allow unread count click in PM row to mark row as read.
Fixes #23261

We now send user to next column after marking a row read. Added a
bit of bottom padding below unread count indicator.
2022-10-24 10:25:21 -07:00
Aman Agrawal 74a97ab398 unread_ops: Add function to mark PM threads as read.
This will be used recent topics to mark PM rows as read.
2022-10-24 10:25:18 -07:00
Aman Agrawal ae5be12540 recent_topics_ui: Extend check for unread to PMs.
Since we also have PMs now, `has_unread` should consider that case
too. This seems like a good change regardless.
2022-10-24 10:23:20 -07:00
Aman Agrawal eb45b8ab70 unread: Rename function name for clarity.
Renamed num_unread_for_person to num_unread_for_user_ids_string.
2022-10-24 10:23:20 -07:00
Aman Agrawal 284c86212c unread: Rename function name for clarity.
Renamed get_msg_ids_for_person to get_msg_ids_for_user_ids_string.
2022-10-24 10:23:20 -07:00
Aman Agrawal 4bc80c30e7 recent_topics_ui: Correct column number of read and mute row. 2022-10-24 10:23:20 -07:00
Ganesh Pawar 914712beab realm_domains: Populate the table only if the modal is open.
Fixes #23315.
2022-10-23 20:38:37 -07:00
Sahil Batra 594eed646a message_edit: Add comment for currently_echoing_messages check. 2022-10-23 20:38:05 -07:00
Sahil Batra 48e31e24fa message_edit: Do not allow moving locally echoed or failed messages.
We should not show UI for moving locally echoed or failed messages.

For the edit/move icon in message controls -
- After 2451002, we showed "Move message" icon for locally echoed
messages when moving messages was allowed as per org permissions.
This was clearly a bug and this commit fixes it and we instead
show "View source" icon.

For "m" hotkey -
- After 2451002, pressing "m" opened "Move messages" modal for
locally echoed messages when moving messages was allowed as per
org permissions. This was clearly a bug and this commit fixes it
and pressing "m" does nothing.

For pencil icon in recipient header -
- Previously, the pencil icon was showed even if first message
below the recipient bar was locally echoed and the topic edit
failed silently with locally echoed or failed messages again
showing under old topic after reload. This commit fixes it
to hide the icon in such cases. The original behavior was
that server returned an error with not so appropriate
response.
- Note that we can only check the first message below the header
since it will be inefficient to check all the messages whether
each of them is successfully sent.
And in such cases when any of the later messages is locally
echoed, the topic edit succeeds but the locally echoed or failed
messages are shown under old topic after reload.
- The behavior is same for the "checkmark" icon for resolving
topics in the header.

For three-dot message menu -
- We don't need to do anything here since the three-dot icon
is not shown for locally echoed or failed messages.

For the "Move topic" option in topic popover in left sidebar -
- We cannot do anything here since it will be inefficient
to check all messages in the topic whether they are locally
echoed or not everytime we open the popover.
- If the first message in topic is locally echoed or a failed
message, then the id of first message of the topic returned
from server is undefined and we see an error in client while
trying to get message from that id. And if one or multiple of
the later messages is locally echoed, then only successful and
server-acked messages are moved.

Note that this cannot handle all cases like a user can use
a successfully sent message to access the topic edit UI
and then choose "change_all" and "change_later" propagate
modes. In such cases the locally echoed and failed messages
will remain in the old topic only.
2022-10-23 20:38:05 -07:00
Sahil Batra 9d2e8aef6d ui_init: Fix condition in message_hover.
The message_hover function in ui_init.js had an if condition
to return early when is_topic_editable was false. We instead
change it to return early when message.sent_by_me is false
since in that case the edit_content element is not present.
Note that we also show the "View source" icon when message
is locally echoed or not sent successfully.

Till now is_topic_editable is always true when message is sent
by the user itself, and when message is sent by someone else
the edit_content element does not exist in the DOM anyway. So,
basically, it just helps in returing early and not unnecessarily
move forward to set html for a non-existent div. So, we can
ideally replace it with just `sent_by_me` condition and otherwise
we already show the reaction icon.

The comment above that also mentioned that "locally echoed messages
have !is_topic_editable" which is not true since is_topic_editable
does not check whether the message is locally-echoed or not. This
comment was added in e1c4c7b80.

This also fixes the bug where "View source" icon is not shown when
"message.sent_by_me" is true and both editing and moving message
is not allowed which currently happens when allow_message_editing
setting is False.

Also, the "is_topic_editable" condition will be not valid in future
when "is_topic_editable" can be false when "sent_by_me" is true. In
such cases we would not show any icon then, so better to fix this
here.

Some history of this code-
- Intially we returned only when !sent_by_me was false, but added
a condition to return early when realm_allow_community_topic_editing
was false in 91197fa4f1. Though it was not needed since edit_content
element amyways did not existed when `sent_by_me` was false.
- Then the condition was then changed to return early if
is_topic_editable was false in 689c717284.
2022-10-23 20:38:05 -07:00
Sahil Batra a023c0bdd5 message_edit: Extract function to check whether message is valid.
We do not allow sending messages where sending request had failed
or message is locally echoed. This commit extracts these checks
to a new function so that we can avoid duplicating code.
2022-10-23 20:38:05 -07:00
Sahil Batra 0b08893147 message_edit: Remove unnecessary comment.
This comment is not required now since topic and
stream editing is not allowed from this UI now
and is instead done from a modal.
2022-10-23 20:38:05 -07:00
evykassirer aebdf6af8c drafts: Fix topic update logic handling of incomplete drafts.
This fixes a couple significant issues with the drafts logic:
* Previously, we would move drafts even when !going_forward_change; this
  is inconsistent with the compose box logic on the previous line.
* The drafts.rename_topic() function did not handle drafts with
  incomplete stream/topic fields correctly, throwing an exception in
  that case; this resulted in user-visible live update problems
  because code after the drafts.rename_topic call would not be
  executed.
2022-10-21 15:33:03 -07:00
Akarsh Jain 9e74f9f1ce message_edit: Fix vertical alignment of input area in /me messages.
Fixes #23101.
2022-10-21 12:16:15 -07:00
Akarsh Jain 3d4a2eb468 message_feed: Fix alignment of EDITED notices in /me message.
Fixes part of #23101.
2022-10-21 12:15:52 -07:00
Akarsh Jain 065f5413ae message_feed: Fix /me message alignment of message actions.
These were apparently no longer aligned with the timestamp.

Fixes #23101.
2022-10-21 12:15:16 -07:00
Lauryn Menard c9044f7acd recent-topics: Rename to "Recent conversations" in web-app and docs.
Replaces instances of "recent topics" in the web-app and documentation
to be "recent conversations".

Renames both `recent-topics.md` files in the help center to be
`recent-conversations.md` and updates/redirects links to new URL.

Does not update instances of "recent topics" in frontend code comments
and does not update the main overview changelog, for now.

Does not change case study text where "recent topics" was referenced
in a quote, but does change generic text references to be "recent
conversations".
2022-10-21 10:28:19 -07:00
Aman Agrawal 1267dce027 navbar: Add login and signup buttons for spectators.
Remove login buttons from right sidebar and add them to navbar
so that the user instantly notices them.
2022-10-21 10:10:40 -07:00
Julia Bichler 91d86a8a6f stream-create: Use simplebar.
This changes the stream creation form so that it uses simplebar
instead of the native scroll bar.

resolves #21307
2022-10-20 17:54:46 -07:00
Tim Abbott 6266954229 user_profile: Remove stale no-fields CSS class.
Previously, we had some special CSS for the user profile modals in the
case that there were no custom profile fields, to do things like hide
the <hr> divider between the normal profile fields and custom ones.

The design has for some time treated custom profile fields as just
additional profile fields; so there's no longer a need for custom CSS.
2022-10-20 11:19:12 -07:00
sayamsamal aec8ef453c user_profile: Move title and tab switcher to a fixed header.
While going through the full profile of a user, we expect to find
that specific user's in-depth details. Thus, we should have a fixed
title displaying the name at the top of the modal to establish the
connection of the profile data with the user.

We also fix the tab switcher between "Profile/Streams/User groups" to
the top of the modal, for the added convinience of switching across
the three options at any point of time.
2022-10-20 11:19:02 -07:00
Akarsh Jain b2cf822fc4 settings: Reorganize organization settings sidebar
Fixes: #23233
2022-10-20 10:40:32 -07:00
Yogesh Sirsat b28efaae76 tippy: Wrap overflowing content of tippy tooltips. 2022-10-20 10:35:11 -07:00
Yogesh Sirsat 0b0a8f4659 user_info_popover: Fix overflow of bot owner list item. 2022-10-20 10:35:11 -07:00
Noble Mittal a2f3c1812d stream_settings: Remove extraneous heading from message retention section 2022-10-20 10:27:53 -07:00
Aman Agrawal e3f22a9907 recent_topics: Add mention indicator in row for unread topics.
Fixes #22984

Add an `@` icon in unread topics where user is mentioned.

We track a new set of `stream_id:topic` pairs for the unread mentions
so that recent topics instantly knows if a topic is unread and mentioned
or not.
2022-10-19 16:26:42 -07:00
Tim Abbott 228ec4bde4 unread: Fix recent topics exception when marking as unread.
This simple regression was introduced in
550a32bb20.
2022-10-19 16:26:42 -07:00
Aman Agrawal f2f4bed85c recent_topics: Set focus to first/last row on page up/down at ends.
This change is to match the behaviour of page up/down on messages.
So, If you hit PageUp/Down while there's no additional pace to scroll,
we move the selected topic to the first/last topic as appropriate.
2022-10-19 14:52:54 -07:00
Aman Agrawal eb1c3bc293 recent_topics: Check if at last row before moving down.
This looks a regression from some of the recent additions to
recent topics.
2022-10-19 14:52:54 -07:00
Aman Agrawal 198f31fbea recent_topics_ui: Use topics_widget to get number of current rows.
I think this should be more reliable and faster.
2022-10-19 14:52:54 -07:00
Aman Agrawal ed2ea4c8cc integrations: Increase font size of logo disclaimer.
Increased font size from 11px to 13px. This text was unreadable
on mobile as per Google report at 11px font size.
2022-10-19 12:03:16 -07:00
Sahil Batra b8a70c71f0 popovers: Rename "Move message" option to "Move messages".
This commit renames "Move message" option to "Move messages"
to make it more clear that the user can move multiple messages.
2022-10-19 12:02:22 -07:00
Sahil Batra cde4377789 message_edit: Allow editing "no topic" message from modal in all cases.
Previously, we allowed editing topic of "no topic" message, when other
conditions were not met, only from recipient bar but it is allowed
irrespective of other condtions. This commit fixes it to show the
"Move message" option and icon for "no topic" messages irrespective
of other conditions.
2022-10-19 12:02:22 -07:00
Sahil Batra 2451002e3b popovers: Use can_move_message function.
We can now directly use `can_move_message` function instead
of checking topic and stream edit permission. This helps us
in avoid duplication of code.
2022-10-19 12:02:22 -07:00
Sahil Batra ad3fe2c0db keyboard_shortcuts: Fix description for "e" shortcut.
This commit updates the description for "e" shortcut so
that it at least fits in one line in english.

Fixes #23112.
2022-10-19 12:02:22 -07:00
Sahil Batra 693a36d680 popovers: Add "(e)" shortcut to "View message source" option. 2022-10-19 12:02:22 -07:00
Sahil Batra eed728fb59 hotkey: Use "m" hotkey for moving messages.
Fixes #23113.
2022-10-19 12:02:22 -07:00