Commit Graph

56046 Commits

Author SHA1 Message Date
Alex Vandiver 07c4291749 message: Rewrite personals query to be more performant and accurate.
The previous query suffered from bad corner cases when the user had
received a large number of direct messages but sent very few,
comparatively.  This mean that the first half of the UNION would
retrieve a very large number of UserMessage rows, requiring fetching a
large number of Message rows, merely to throw them away upon
determining that the recipient was the current user.

Instead of merging two queries of "last 1k received" + "last 1k sent",
we instead make better use of the UserMessage rows to find "last 1k
sent or received."  This may change the list of recipients, as large
disparities in sent/received messages may result in pushing the
most-recently-sent users off of the list.  These are likely uncommon
edge cases, however -- and the disparity is the whole reason for the
performance problem.

This also provides more correct answers.  In the case where a user's
1001'th message sent was to person A today, but my most recent message
received was from them yesterday, the previous plan would show the
message I received yesterday message-id as the max, and not the more
recent message I sent today.

While we could theoretically raise the `RECENT_CONVERSATIONS_LIMIT` to
more frequently match the same recipient list as previously, this
increases the cost of the most common cases unreasonably.  With a
1000-message limit, the common cases are slightly faster, and the tail
latencies are very much improved; raising `RECENT_CONVERSATIONS_LIMIT`
would increase the result similarity to the old algorithm, at the cost
of the p50 and p75.

|        |   Old   |   New   |
| ------ | ------- | ------- |
| Mean   | 0.05287 | 0.02520 |
| p50    | 0.00695 | 0.00556 |
| p75    | 0.05592 | 0.03351 |
| p90    | 0.14645 | 0.08026 |
| p95    | 0.20181 | 0.10906 |
| p99    | 0.30691 | 0.16014 |
| p99.9  | 0.57894 | 0.19521 |
| max    | 22.0610 | 0.22184 |

On the whole, however, the much more bounded worst case are worth the
small changes to the resultset.
2024-01-18 09:30:20 -08:00
Alya Abbott 57b5be6c91 billing: Rename button to apply for sponsorship or discount.
It was not clear that the button could be used for discounts.
2024-01-18 08:33:08 -08:00
Shubham Padia afac26e3e9 refactor: Don't use today arg from render_now in timerender tests.
We cannot remove the today argument for render_now since it is being
used in one other place: timerender.update_timestamps .
2024-01-18 08:32:30 -08:00
Shubham Padia a43a898e12 refactor: Remove today arg from absolute_time.
The today argument was only used in tests and now we're using
MockDate to set the current date.
2024-01-18 08:32:30 -08:00
Shubham Padia 3d2110be51 refactor: Remove current_date arg from last_seen_status_from_date.
The current_date argument was only used in tests and now we're using
and now we're using MockDate in tests.
2024-01-18 08:32:30 -08:00
Shubham Padia d5de26ff3b refactor: Remove current_date arg from relative_time_string_from_date.
The current_date argument was only used in tests and now we're using
MockDate to set the current date.
2024-01-18 08:32:30 -08:00
Shubham Padia 3a233d73c1 refactor: Remove today arg from render_date and use MockDate for tests.
Fixes #26774.
We don't need the today argument anymore since every value passed to
it was a new Date() except the tests where we are using MockDate now.
2024-01-18 08:32:30 -08:00
Aman Agrawal a15d4e2be7 narrow: Extract common methods around setting current list.
This will help us combine activate and deactivate.
2024-01-18 08:31:48 -08:00
Aman Agrawal 9aa8c1f156 lightbox: Use rows module to query message_row elements. 2024-01-18 08:31:48 -08:00
Aman Agrawal 07cc079c8d narrow: Remove unused `narrowed_view` class. 2024-01-18 08:31:48 -08:00
Aman Agrawal 514075329b pm_list: Remove not needed narrow_state mock. 2024-01-18 08:31:48 -08:00
Aman Agrawal 1f1749ffb1 actions_popover: Remove unused parameter `narrowed`. 2024-01-18 08:31:48 -08:00
Aman Agrawal df180f7bd5 single_message: Use data-message-id instead of zid. 2024-01-18 08:31:48 -08:00
Aman Agrawal 633f64a79e narrow: Use message list id to track message lists in DOM.
This removes use of zfilt and zhome from codebase.
2024-01-18 08:31:48 -08:00
Alya Abbott 91ee0bf676 emails: Remove organization type from sponsorship request emails.
This makes the subject nicer for replying to these emails.
2024-01-17 16:44:06 -08:00
Alya Abbott 8272210b47 notifications: Add # to stream name in desktop notifications.
Follows the general pattern of always using a stream marker.
2024-01-17 16:39:41 -08:00
CIC4DA c7fc82727f inbox_ui: Use Intl.ListFormat rather than .join(", "). 2024-01-17 13:43:17 -08:00
CIC4DA ea6b3b84c4 settings_org: Use Intl.ListFormat rather than .join(", "). 2024-01-17 13:43:17 -08:00
CIC4DA caa2dbbba4 filter: Use Intl.ListFormat rather than .join(", "). 2024-01-17 13:43:17 -08:00
CIC4DA cd91bc3d71 compose_ui: Use Intl.ListFormat rather than .join(", ") 2024-01-17 13:43:17 -08:00
CIC4DA efb2a5a38d util: Defining common formatter function 2024-01-17 13:43:17 -08:00
Aman Agrawal e2520da24d event_status: Avoid ever-increasing calls to start_status_polling.
In case, we have an error and `completed` is `false`, we start
two loops of `start_status_polling` which keep increasing with
each call.
2024-01-17 12:46:44 -08:00
Aman Agrawal 6d50a3b2db billing: Fix `Update card` from billing page not working.
Since we don't provide `tier` info to session on billing page,
it was not working.
2024-01-17 12:46:44 -08:00
Aman Agrawal 884c44d3cb stripe: Avoid redirects from `event_status` to `event_status/`. 2024-01-17 12:46:44 -08:00
Alya Abbott f1e78d2135 help: Tweak instructions for finding your Zulip account. 2024-01-17 12:45:50 -08:00
vighneshbhat9945 59a7a2e11d
settings: Use correct tooltips for deactivated bots.
Added handlebars if-else conditions to display
'User is deactivated' tooltip for deactivated users
and 'Bot is deactivated' tooltip for deactivated bots.

Fixes #28593.
2024-01-17 12:45:03 -08:00
Vidhi Agrawal b21dc465b8 billing: Change background color of reactivate subscription.
Fixes #28428
2024-01-17 12:43:01 -08:00
Prakhar Pratyush 3afc8ed7ae webhooks: Rename *topic local variables to *topic_name.
This is preparatory work towards adding a Topic model.
We plan to use the local variable name as 'topic' for
the Topic model objects.

Currently, we use *topic as the local variable name for
topic names.

We rename local variables of the form *topic to *topic_name
so that we don't need to think about type collisions in
individual code paths where we might want to talk about both
Topic objects and strings for the topic name.
2024-01-17 08:35:29 -08:00
Lauryn Menard 030f899195 realm-activity: Merge chart for human and bot users.
Merges the two charts remaining to have just one chart for the
realm activity view.

Removes the columns for different clients and adds a column to
show/sort by the user type (human or bot type).

Deletes templates/analytics/activity.html because it is no
longer used for any activity pages/views.
2024-01-16 09:43:42 -08:00
Lauryn Menard 82e3d0388b realm-activity: Remove Clients and History charts.
Removes the Clients and History tabs/charts from the realm
activity view.
2024-01-16 09:43:42 -08:00
Lauryn Menard ec5e215e8f user-activity: Remove user activity summary chart.
Removes the summary tab/chart from the user activity view.

Moves get_user_activity_summary from common_activity.py to
realm_activity.py since it's no longer used in the user
activity view.

Updates the title of the page to incluce the realm name since
an email address may be used for multiple user accounts.
2024-01-16 09:43:42 -08:00
swayam0322 16988a5188 find_account: Remove emails as URL parameters.
Earlier, after a successful POST request on find accounts page
users were redirected to a URL with the emails (submitted via form)
as URL parameters. Those raw emails in the URL were used to
display on a template.

We no longer redirect to such a URL; instead, we directly render
a template with emails passed as a context variable.

Fixes part of #3128
2024-01-16 09:39:00 -08:00
Aman Agrawal 781473414f drafts: Fix flaky drafts tests.
There were two typeahead displayed while we were testing
create_private_message_draft. One was topic typeahead from previous
create_stream_message_draft test and the other was cordelia
DM typeahead. So, when clicking on the typeahead, we clicked
the topic typeahead when we really wanted to select the cordelia
typeahead. This resulted in drafts test failing.
2024-01-16 09:31:10 -08:00
Aditya Kumar Kasaudhan 8f39b6f905
e2e-tests: Rename display_settings_section to preferences_section.
Fixes part of #26874.
2024-01-16 09:29:40 -08:00
Karl Stolley 906559c2b5 portico: Extend proper background gradients to /plans. 2024-01-15 18:43:33 -08:00
Karl Stolley cc4bb3493a portico: Scope pricing-plans styles to pages that need it. 2024-01-15 18:43:33 -08:00
Karl Stolley f5245285b4 portico: Isolate global plans-page styles in own file. 2024-01-15 18:43:33 -08:00
Alex Vandiver b10c611840 home: Redirect https://selfhosting.zuliphostname/ to /serverlogin/.
This is a reasonable default page to render for that hostname, and
less confusing than "Organization does not exist."
2024-01-15 17:55:42 -08:00
Alex Vandiver adf9e8de3d home: Redirect https://auth.zuliphostname/ to https://zuliphostname/.
It is confusing for folks directing accessing the page to get a
"Organization does not exist" message.
2024-01-15 17:55:42 -08:00
Tim Abbott ef3f990324 tools: Add a tool for backporting PRs. 2024-01-15 17:27:37 -08:00
Mateusz Mandera 100cef9186 templates: Move remote_realm_server_mismatch_error.html to zerver.
This is rendered by regular self-hosted servers, so doesn't belong in
zilencer.
2024-01-15 16:50:48 -08:00
Mateusz Mandera fc247cba3f 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 16:50:48 -08:00
shashank-23002 dcec36b824 typeaheads: Fix mention typeaheads spill width.
Fixes: #27825
2024-01-15 16:17:11 -08:00
Aman Agrawal 272337f0f9 filter: Remove incorrect check for `All messages` view.
All message view has `in-home` filter and is not empty.
If there are no terms provided, we set filter to display
all messages (including muted streams/topics).

We make it mandatory to provide terms to Filter.
2024-01-15 12:26:24 -08:00
Aman Agrawal 5357b9814e search: Check for narrow_state.filter being undefined. 2024-01-15 12:26:24 -08:00
Aman Agrawal b36163dd8f typing_events: Handle search_terms() being an empty list. 2024-01-15 12:26:24 -08:00
Aman Agrawal a217138788 message_list: Check filters to decide if list is narrowed.
All messages list always has the "in-home" filter. We are in the
process of removing "zhome/zfilt" from message list, so this would
help in that process.
2024-01-15 12:26:24 -08:00
Aman Agrawal 2f8b82d808 upload: Fix drag drop not working for edit message in `All messages`.
Instead of `zfilt`, we should use table name of the current
message list.
2024-01-15 12:26:24 -08:00
Aman Agrawal 2fdd43a917 filter: Fix tests for guest user without indicator. 2024-01-15 12:26:24 -08:00
Aman Agrawal 5b0d346dd9 filter: Don't modify original terms when testing. 2024-01-15 12:26:24 -08:00