Commit Graph

14409 Commits

Author SHA1 Message Date
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