Commit Graph

3106 Commits

Author SHA1 Message Date
Aman Agrawal c440958ecf personal_menu: Fix clicking on `Set status` not working.
Use `tabindex` instead of `href` to set focus on `a` tag.

Ideally, we should use `button` for these elements but since
we want to keep the pattern for these dropdowns same where some
`a` elements do have a valid `href`.

(cherry picked from commit 95e74558c5)
2024-03-01 09:26:25 -08:00
Aman Agrawal 0a97e41581 Revert "desktop_app: Close popover when clicking on "Plan management"."
This reverts commit 1f79e6294f.
No longer required after
70ba7cc042

(cherry picked from commit 569b2c8a60)
2024-03-01 09:26:25 -08:00
Aman Agrawal 2530566774 popover_menu: Fix popover not closed on clicking external links.
For example, gear menu was not closed after `Integrations` button
was clicked since we don't have an event handler which opens
`/integrations` in a new tab but we let the browser navigate user
to `/integrations` after clicking on `a href='/integrations'`.

There was no handler for hiding the popover after clicking on such
links, so this commit adds one.

(cherry picked from commit 70ba7cc042)
2024-03-01 09:26:25 -08:00
Lalit edeea66b0f ts: Migrate `popover_menus` to typescript.
This commit migrates `popover_menus` module to TypeScript. Also adds
a placeholder types declaration file for `css_variables` module.

(cherry picked from commit 02257b8cbf)
2024-03-01 09:26:25 -08:00
sujal 8b1a62f36c setting_ui: Fix sorting by "Expires at" column.
Previously, the sorting was broken due to
incorrect referencing of the property.
The code has been updated to use the "expiry_date"
property instead of "expires_at".

Fixes #29005.

(cherry picked from commit bf464db61b)
2024-03-01 09:26:25 -08:00
Karl Stolley 1b451d1958 left_sidebar: Remove padding from bot icon.
This is no longer necessary for vertical alignment, and by
removing the 6px of padding it represents, bot DM rows will have
the same 22px height as other DM rows.

(cherry picked from commit ea83b1f4de)
2024-03-01 09:26:25 -08:00
Karl Stolley fb9c47838d left_sidebar: Remove unnecessary padding on bot icon.
(cherry picked from commit 9887b00317)
2024-03-01 09:26:25 -08:00
Tim Abbott b4f95a54e1 puppeteer: Disable flaky administrative UI test.
(cherry picked from commit ea89a4c6f7)
2024-02-16 15:24:39 -08:00
Sahil Batra f323aa9709 settings: Fix check_property_changed code for user access setting.
The proposed_val for "realm_can_access_all_users_group" setting
was always returning NaN value which resulted in the value
being included in request even when it was not changed or disabled
due to org not being on "Plus" plan. This resulted in a bug where
user was not allowed to change the "guest" indicator setting
on orgs without "Plus" plan.

For orgs with "Plus" plan there was no problem in changing the
setting but the save button was visible incorrectly if the setting
was set to the initial value.

This commit fixes both the bugs.

(cherry picked from commit 4a98eb205d)
2024-02-16 12:28:16 -08:00
Sahil Batra 727a1eeb1d admin: Remove unnecessary development_environment check.
The "Who can access all users" setting is not disabled for
organizations not on "Plus" plans in production because of
the "page_params.development_environment" check.

We do not need that check anymore as the feature is now
enabled in production.

(cherry picked from commit ae9ef830f0)
2024-02-16 12:28:16 -08:00
Tim Abbott 2064a9da12 web: Use better exponential backoff algorithm.
This matches the algorithm that we designed for the Python API, except
that we use a ratio of 2 rather than sqrt(2) in the message_fetch code
path, because it's a heavier request.

We increase the number of failures before showing a user-facing error
to roughly preserve the same time period before a user-facing error is
shown.

(cherry picked from commit b5b496c752)
2024-02-16 12:28:16 -08:00
Tim Abbott 47e228882c web: Respect rate-limiting headers in main APIs.
Previously, these endpoints just did exponential backoff, without
looking at the rate-limiting headers returned by the server, resulting
in requests that the client could have been certain would fail with an
additional rate-limiting error.

Fix this by using the maximum of the existing exponential backoff with
the value returned by the rate-limiting header.

Fixes #28807.

(cherry picked from commit e3960c22be)
2024-02-16 12:28:16 -08:00
Tim Abbott dbbf860fbb message_fetch: Add small backfill delay.
This should help reduce the risk of hitting rate limits when users
have a very large number of messages to fetch via this mechanism.

Inline the `messages` variable that was only used in one place while
we're touching this.

(cherry picked from commit 8f32ebe706)
2024-02-16 12:28:16 -08:00
Tim Abbott ae05d780c7 reload: Add on-focus handler after a delay.
(cherry picked from commit 9479eae87f)
2024-02-16 12:28:16 -08:00
Tim Abbott 187c9e4b14 util: Fix call_function_periodically.
This function incorrectly and misleadingly did an immediate initial
call, despite both of its callers doing immediate calls themselves (in
one case, with a different parameter passed).

This led to unnecessary server load when reloading the app via event
system triggered reloads, since every client would call `/` twice.

(cherry picked from commit 2c56978b02)
2024-02-16 12:28:16 -08:00
Aman Agrawal 2794c779da narrow: Fix message row partially visible on narrow.
This will prevent any message we want to select after narrowing
from being offscreen entirely or partially.

Steps to reproduce the bug:
* `./manage.py populate_db -n 3000 --max-topics=2`
* Narrow to a stream and scroll high up.
* Align two recipient bars together with nothing between them.
* Click on the first recipient bar after keeping the selected message
  on the second recipient bar.
* You will see that the selected message is not in view.

(cherry picked from commit 120ff78516)
2024-02-16 12:28:16 -08:00
Aman Agrawal 9b49909d3e compose_actions: Fix incorrect condition.
This was introduced in #28767 with the intention to skip scrolling
the selected message.

So, the actual bug that the PR fixed would have been just fixed
by opening the compose box early.

(cherry picked from commit aa76919ddb)
2024-02-16 12:28:16 -08:00
Tim Abbott c9eb942105 narrow: Clarify some confusing details.
The update_selection function name was rather misleading, since that
function call is in fact what renders the message list object for the
view.

Also add comments about a few subtle/confusing details that I noticed
while debugging this code path today.

(cherry picked from commit 61ff8f2bef)
2024-02-16 12:28:16 -08:00
Tim Abbott 8b8ab7fb9c narrow: Open compose box before rendering main message feed.
As discussed in the new comments, we had a bug where the
system-initiated animated scroll that happens when the compose box
opens as a result of narrowing would race with the internal
rerendering that occurs when the message_fetch request asking the
server for additional data returns.

The correct fix for this is just to open the compose box, if we're
going to do so, before setting the user's scroll position in the
narrowing/rendering process.

This ends up being a UI improvement (in that the compose box is
available for typing a bit earlier) as well as avoiding both the risk
of this race as well as the bad UX of adjusting the user's scroll
position multiple times as part of entering the view.

This does not address an as-yet-unknown bug wherein the animated
scroll that occurs when opening the compose box, when racing with a
background rerender, results in a bogus ending scroll position, though
it's easy to see how that might occur given that rerendering does
clear the DOM briefly.

(cherry picked from commit 4e2a282a1b)
2024-02-16 12:28:16 -08:00
Anders Kaseorg 6e09c01772 typeahead: Remove insecure default highlighter implementation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-24 16:46:02 -08:00
Anders Kaseorg bc5d4b565a settings_playgrounds: Fix HTML injection in language typeahead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-24 16:46:02 -08:00
Sahil Batra 0ebe623b42 group_settings: Empty right panel based on the url hash.
This commit adds code to empty the right panel if hash is
changed to "#groups/your" or "#groups/all".

(cherry picked from commit fc8e6d2aa8)
2024-01-24 16:38:46 -08:00
Sahil Batra 8549e9b648 groups_settings: Fix browser back button for groups overlay.
There is no problem in behavior of browser back button if we open
the group settings overlay using "#groups/your", "#groups/all" or
"#groups/new" url hash, but someone can directly go to a link with
"#groups" and in this case we want to fix the browser back button.

This commit replaces "#groups" entry with "#groups/your" which is the
default section opened, such that pressing back when on "#groups/your"
does not go to "#groups", which will then a form a cycle and instead
go back actually.

(cherry picked from commit c6be850fb9)
2024-01-24 16:38:46 -08:00
Sahil Batra 9a04f5b0c4 gear_menu: Open group settings overlay with "#groups/your" hash.
This commit fixes the bug in browser back button behavior when
opening the groups overlay from gear menu. The bug was caused
due to browser history containing both "#groups" and "#groups/your"
entries, which essentially resulted in a "#groups/your" -> "#groups"
-> "#groups/your" cycle and thus nothing happend on clicking
browser back button.

The case for a user manually typing "#groups" url would be handled
in next commit.

(cherry picked from commit eced3d9d6a)
2024-01-24 16:38:46 -08:00
Sahil Batra c8fe3d941c groups_settings: Make "Cancel" button work in group creation form.
(cherry picked from commit 3549164827)
2024-01-24 16:38:46 -08:00
Tim Abbott ddc88d2a45 compose: Simplify convert_mentions_to_silent_in_direct_messages.
The behavior to replace existing message content was leftover code
from a previous version of the mechanism, and not intended.

(cherry picked from commit 85ee5255bc)
2024-01-22 18:19:09 -08:00
Tim Abbott e332f4f4f2 compose: Don't convert bot mentions to silent mentions.
This fixes an unintended consequence of the silent mention conversion
logic added in 4d1ade1f88, where bots
that looked for personal mentions would not process mentions in 1:1
DMs.

(cherry picked from commit 60afdc45eb)
2024-01-22 18:19:09 -08:00
N-Shar-ma dfb4fc4261 compose: Revamp and improve test suite for compose formatting buttons.
Earlier, the tests for compose formatting were verbose, hard to read as
well as extend, and overly granular, without even having the ability to
test the final text selection or the cursor position.

Now, new test helpers, `init_textarea_state` and `get_textarea_state`,
have been added, enabling the tests to be more concise and readable,
while also being more powerful. A representative string alone now
describes the textarea state (the text and the selection / cursor),
making each test case as easy as defining the initial state as a string
and comparing the expected state post formatting with another string.

These new tests helped surface a couple bugs which have been fixed in
preceding commits.

(cherry picked from commit 179e9374b4)
2024-01-22 18:19:09 -08:00
N-Shar-ma c4d567c792 compose: Fix bug where toggling off link formatting left extra spaces.
In cases where either the description or the URL, or both were empty,
there would be an unneeded space, originally intended to space out the
description and URL, lingering even when the description and/or URL was
missing. The resulting highlight would also be off at times.

Now we only add in a space if both the description and URL are present,
and the highlight too is as intended.

(cherry picked from commit a5889bc3af)
2024-01-22 18:19:09 -08:00
N-Shar-ma b1fcbfd89a compose: Fix bug where spoiler would not always start on a new line.
Earlier, when a selection not starting at the beginning of a line was
formatted as a spoiler, the spoiler would not start on a new line, and
so would not be rendered as a spoiler. The `Header` highlighting too
was off by one character.

Now, the spoiler starts on a new line, and the `Header` highlighting
works as expected too.

(cherry picked from commit c46375f6fc)
2024-01-22 18:19:09 -08:00
sayyedarib 7a474e4cbf status_emoji_selector: Replace fa-smile with custom zulip-smile-icon.
Signed-off-by: sayyedarib <sayyedaribhussain4321@gmail.com>
(cherry picked from commit ff4d4dd31b)
2024-01-22 18:19:09 -08:00
sayyedarib 8b00c9a9dd user_status: Fix alignment of select-emoji icon of user-status modal.
use flex display justify-content for vertical alignment
instead of using offsets like "top". for horizontal
alignment of smiley-icon use text-align center.

Signed-off-by: sayyedarib <sayyedaribhussain4321@gmail.com>
(cherry picked from commit c1b8e45216)
2024-01-22 18:19:09 -08:00
Mateusz Mandera a96c821651 desktop_app: Close popover when clicking on "Plan management".
(cherry picked from commit e916ae754a)
2024-01-18 15:58:02 -08:00
Mateusz Mandera ba50faced4 remote_billing: Fix /self-hosted-billing/ handling for desktop app.
When you click "Plan management", the desktop app opens
/self-hosted-billing/ in your browser immediately. So that works badly
if you're already logged into another account in the browser, since that
session will be used and it may be for a different user account than in
the desktop app, causing unintended behavior.

The solution is to replace the on click behavior for "Plan management"
in the desktop app case, to instead make a request to a new endpoint
/json/self-hosted-billing, which provides the billing access url in a
json response. The desktop app takes that URL and window.open()s it (in
the browser). And so a remote billing session for the intended user will
be obtained.
2024-01-15 21:32:00 -08:00
afeefuddin 5841813ac4 portico-header: Dropped find accounts link for smaller windows.
Fixes #27477

(cherry picked from commit 76d79701a2)
2024-01-15 12:02:53 -08:00
Anders Kaseorg ea862aa29f notification_settings: Open push notification docs link in new tab.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit f93fbd34c7)
2024-01-15 12:02:53 -08:00
Vector73 e2cb2da864 settings: Fix setting label click functionality.
This commit fixes "Automatically follow topics where I'm mentioned"
setting label click functionality so that the setting is toggled
on clicking the label .

(cherry picked from commit 1c286a6835)
2024-01-15 12:02:53 -08:00
Anders Kaseorg bb7b9af676 user_status: Fix parsing of partial user_status events.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit dd3a8ce3b5)
2024-01-15 12:02:53 -08:00
Sahil Batra e67c0d19c5 user_pill: Add support to not allow adding inaccessible users manually.
We previously allowed adding pills for inaccessible user by typing
the email manually. This commit updates it to handle inaccessible
users like we handle invalid emails.

(cherry picked from commit 9197a2c3e2)
2024-01-05 10:32:54 -05:00
Sahil Batra f9eea995fd input_pill: Define a type for pill_config object.
(cherry picked from commit ede88191a8)
2024-01-05 10:32:54 -05:00
Alya Abbott 3decf380d7 settings: Update description text in Settings > Topics panel.
(cherry picked from commit 2732da2bb2)
2024-01-05 10:32:54 -05:00
N-Shar-ma 6b0ad1a7f5 compose: Clear stream id when prompting user for stream selection.
Now we clear the stream id from the compose state on opening the stream
selection dropdown when no stream is specified.

This fixes the bug where the compose box placeholder text would refer to
the previously selected stream, even when the open stream dropdown had
no stream selected.

(cherry picked from commit 48d0d49fde)
2024-01-05 10:32:54 -05:00
Joydeep Bhattacharjee ba39529100 css: Fix the color of alert word in dark theme.
This was incorrectly not declared as a theme-dependant color.

Fixes #28407.

(cherry picked from commit e3744627ac)
2024-01-05 10:32:54 -05:00
Sahil Batra 4c01110c88 settings: Fix discard button in groups UI in dark theme.
(cherry picked from commit 8f795e22e8)
2024-01-05 10:32:54 -05:00
Sahil Batra 660edba4dd user_groups: Do not remove the user group row if user can join again.
We now do not remove the user group row immediately from "Your groups"
panel when user is removed from the group, if the user can join that
group again by themselves. This makes the behavior similar to what
we have for streams.

(cherry picked from commit 377df9e4db)
2024-01-05 10:32:54 -05:00
Sahil Batra f799190bea settings: Show push notifications tooltip on stream specific row.
This commit fixes the bug about not showing the tooltip about push
notifications not being enabled on the server on checkbox in stream
specific notification row.

(cherry picked from commit 415fb2014b)
2024-01-05 10:32:54 -05:00
Sahil Batra 4e549e684f settings: Do not show tooltip if push notifications are enabled.
We previously showed tooltips about push notifictions not being
enabled on server on the checkboxes in "Notification triggers"
section incorrectly when server had push notifications enabled.

This bug was present as realm_push_notifications_enabled was
not passed to the template correctly. This commit fixes it by
instead using "is_disabled" in the "if" condition as we only
expect it to be true when push notifications are not enabled
on server.

(cherry picked from commit 99f29983a1)
2024-01-05 10:32:54 -05:00
Anders Kaseorg 776a0eeae8 models: Extract zerver.models.streams.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-05 10:32:54 -05:00
Anders Kaseorg ee85ac5433 models: Extract zerver.models.users.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-05 10:32:54 -05:00
Anders Kaseorg f78d8e13c1 models: Rename zerver/models.py to zerver/models/__init__.py.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-05 10:32:54 -05:00