Commit Graph

56701 Commits

Author SHA1 Message Date
Anders Kaseorg 823e8d8716 state_data: Fix custom_profile_fields type for CHOICE → SELECT rename.
Commit bd6471f0e3 (#28691) added this
reference to the old name, even though it had already been renamed in
commit b220d29fed (#17775), presumably
because that had failed to update the OpenAPI description.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 16:00:25 -05:00
evykassirer 07b2ad27fa topic edit: Warn when renaming a topic to an existing topic name.
Fixes #27369.

When editing a topic name via the topic header bar, it's easy to
accidentally move messages into an existing topic, which is
difficult to undo. This commit adds a confirmation modal for when
this is about to happen.
2024-02-15 11:58:23 -08:00
evykassirer 42122b851c message edit: Remove unused message_id assignment. 2024-02-15 11:58:23 -08:00
evykassirer c86558521f message edit: Remove redundant if clause.
`topic_changed` must be true by this point, because
of the earlier return statement.
2024-02-15 11:58:23 -08:00
evykassirer 47560d0b8b confirm dialog: Allow conf to override defaults. 2024-02-15 11:58:23 -08:00
Karl Stolley 9c77300c5a bootstrap: Remove body selectors, zero margin/padding explicitly. 2024-02-15 10:31:29 -08:00
Karl Stolley 79959573bd bootstrap: Remove unnecessary root properties.
* `font-size: 100%` is unnecessary, as `font-size: 16px` is set on
  the `body` selector.
* `text-size-adjust` is unnecessary, as supporting browsers appear
  to use `100%` as a default value anyway.
2024-02-15 10:31:29 -08:00
Lauryn Menard 230294cfb3 remote-activity: Add column for remote server or realm creation date.
Expands the main query for remote servers to get the audit log
event datetime for when the server was created/registered.

The remote realm object has a field for when the remote realm
was created on the remote server.
2024-02-15 10:29:12 -08:00
Anders Kaseorg bf6978185d home: Send state_data in a separate object.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg b9e62c7af8 page_params: Split out state data for realm.
For spectators, the chunk of page_params that originates from
do_events_register isn’t assigned until ui_init.js.  That means the
TypeScript type of page_params is mostly a lie during module load
time: reading a parameter too early silently results in undefined
rather than the declared type, with unpredictable results later on.

We want to make such an early read into an immediate runtime error,
for both users and spectators consistently, and pave the way for
runtime validation of the page_params type.  As a second step, split
out the subset of fields that pertain to the entire realm.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg e96ede0ef6 page_params: Split out state data for current user.
For spectators, the chunk of page_params that originates from
do_events_register isn’t assigned until ui_init.js.  That means the
TypeScript type of page_params is mostly a lie during module load
time: reading a parameter too early silently results in undefined
rather than the declared type, with unpredictable results later on.

We want to make such an early read into an immediate runtime error,
for both users and spectators consistently, and pave the way for
runtime validation of the page_params type.  As a first step, split
out the subset of fields that pertain to the current user.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg fd2ad130f9 page_params: Move max_message_id to local_message.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg 2d575ae576 page_params: Move queue parameters to server_events.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg 26df98a2fb echo: Remove unnecessary page_params.queue_id reference.
The web app never gets a new queue ID.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg e4bbd04f5d page_params: Remove muted_users from type.
ui_init.initialize_everything removes this from page_params with
pop_fields("muted_users").

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
Anders Kaseorg 80a6b12690 docs: Optimize /api links to skip trailing slash redirect.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-14 21:06:03 -05:00
Varun-Kolanu e0339715cc skip_navigation: Add skip navigation link to /help and /api sites.
Skip navigation links added in /help and /api sites for accessibility
Fixes #28564.
2024-02-14 15:08:45 -06:00
Vector73 6801ea33ba message_move: Disable stream select dropdown for unprivileged users.
This commit disables the stream-select dropdown in the "Move message"
modal if the user is not allowed to move messages between streams, and
adds a tooltip for clarification when the dropdown is disabled.

 Fixes #28345.
2024-02-14 12:46:13 -08:00
Alex Vandiver 23baabba86 message: Merge unnecessary cache_transformer step.
Having a non-identity `cache_transformer` is no different from running
it on every row of the query_function.  Simplify understanding of the
codepath used in caching by merging the pieces of code.
2024-02-14 12:27:03 -08:00
Alex Vandiver 6597c560cb message_cache: Rename "to_dict" functions which deal with bytes. 2024-02-14 12:27:03 -08:00
Alex Vandiver b3e8878252 message_cache: Rename update_to_dict_cache to update_message_cache.
This better describes what it does.
2024-02-14 12:27:03 -08:00
Alex Vandiver 737a751f5c message: Split MessageDict and friends into its own file. 2024-02-14 12:27:03 -08:00
Alex Vandiver 0f9b7f112b message: Move render_markdown into zerver.lib.markdown. 2024-02-14 12:27:03 -08:00
Alex Vandiver 22837fc1b4 message_edit: Carry the QuerySet through as much as possible.
Rather than pass around a list of message objects in-memory, we
instead keep the same constructed QuerySet which includes the later
propagated messages (if any), and use that same query to pick out
affected Attachment objects, rather than limiting to the set of ids.
This is not necessarily a win -- the list of message-ids *may* be very
long, and thus the query may be more concise, easier to send to
PostgreSQL, and faster for PostgreSQL to parse.  However, the list of
ids is almost certainly better-indexed.

After processing the move, the QuerySet must be re-defined as a search
of ids (and possibly a very long list of such), since there is no
other way which is guaranteed to correctly single out the moved
messages.  At this point, it is mostly equivalent to the list of
Message objects, and certainly takes no less memory.
2024-02-14 12:27:03 -08:00
Alex Vandiver 5c96f94206 topic: Use a single SQL statement to propagate message moves.
Rather than use `bulk_update()` to batch-move chunks of messages, use
a single SQL query to move the messages.  This is much more efficient
for large topic moves.  Since the `edit_history` field is not yet
JSON (see #26496) this requires that PostgreSQL cast the current data
into `jsonb`, append the new data (also cast to `jsonb`), and then
re-cast that as text.

For single-message moves, this _increases_ the SQL query count by one,
since we have to re-query for the updated data from the database after
the bulk update.  However, this is overall still a performance
improvement, which improves to 2x or 3x for larger topic moves.  Below
is a table of duration in seconds to run `do_update_message` to move a
topic to a new stream, based on messages in the topic, for before and
after this change:

| Topic size |  Before  |  After  |
| ---------- | -------- | ------- |
| 1          |   0.1036 |  0.0868 |
| 2          |   0.1108 |  0.0925 |
| 5          |   0.1139 |  0.0959 |
| 10         |   0.1218 |  0.0972 |
| 20         |   0.1310 |  0.1098 |
| 50         |   0.1759 |  0.1366 |
| 100        |   0.2307 |  0.1662 |
| 200        |   0.3880 |  0.2229 |
| 500        |   0.7676 |  0.4052 |
| 1000       |   1.3990 |  0.6848 |
| 2000       |   2.9706 |  1.3370 |
| 5000       |   7.5218 |  3.2882 |
| 10000      |  14.0272 |  5.4434 |
2024-02-14 12:27:03 -08:00
Alex Vandiver 822131fef4 message: Add a bulk_access_stream_messages_query method.
This applies access restrictions in SQL, so that individual messages
do not need to be walked one-by-one.  It only functions for stream
messages.

Use of this method significantly speeds up checks if we moved "all
visible messages" in a topic, since we no longer need to walk every
remaining message in the old topic to determine that at least one was
visible to the user.  Similarly, it significantly speeds up merging
into existing topics, since it no longer must walk every message in
the new topic to determine if the user could see at least one.

Finally, it unlocks the ability to bulk-update only messages the user
has access to, in a single query (see subsequent commit).
2024-02-14 12:27:03 -08:00
Alex Vandiver 628be8d433 streams: Remove a lie from the docstring. 2024-02-14 12:27:03 -08:00
Alex Vandiver e04891779f message_edit: len(changed_messages) is always > 0.
It is only ever added to, and starts as a one-element list.
2024-02-14 12:27:03 -08:00
Tim Abbott 79ddfa1e6f message_edit: Ensure gaining_usermessage_user_ids is set.
This makes this code path a bit easier to follow.
2024-02-14 12:27:03 -08:00
Tim Abbott 4a049299ee message_edit: Clarify unmodified_user_messages logic. 2024-02-14 12:27:03 -08:00
Alex Vandiver 06710631ff tests: Reserve "Internal" client, used by email gateway and topic moves. 2024-02-14 12:27:03 -08:00
Alex Vandiver 7f46773ef1 tests: Clear in-memory Client caches before testing query counts.
This makes counts more apples-to-apples comparable when run
back-to-back.
2024-02-14 12:27:03 -08:00
Sahil Batra 30fc4f7832 groups: Disable "Add" button in members list if input is empty.
We previously had code to disable the "Add" button initially but
then we re-enabled it again if user had permission to add members.

We do not need that code to enable/disable the button based on
permission since the button is disabled initially and it is
only enabled when user updates the input which is not allowed
if users is not allowed to add members.
2024-02-14 12:26:07 -08:00
Sahil Batra e6e806f656 groups: Do not allow user to type when not allowed to add members.
Previously, we allowed user to type in the input even when user
was not allowed to add members to the group. This commit fixes that.
2024-02-14 12:26:07 -08:00
Sahil Batra ed1bc84566 group-members: Remove the error/success message on typing in input.
Previously, when there is no valid pill in the members list and
user clicks on "Add" button, then "No user to add" error is shown
but the error message is visible until successful user is added
and the same goes for success messages too.

This commit updates the code to remove both error and success
messages when user types in the input.
2024-02-14 12:26:07 -08:00
cherish2003 f4016eb3bf stream-subscribers: Remove the error/success message on typing in input.
Previously, when there is no valid pill in the members list and user
clicks on "Add" button, then "No user to subscribe" error is shown
but the error message is visible until successful user is added and
the same goes for success messages too.

This commit updates the code to remove both error and success messages
when user types in the input.

Fixes #27438.
2024-02-14 12:26:07 -08:00
somudas f00f4f95be stream_settings: Make stream name in right panel header a link.
The stream name in right side header is now a link to the stream
narrow.

Fixes #25171.
2024-02-14 11:27:41 -08:00
qx24680 86e306a679 settings: Improve placeholder text for empty settings tables.
Fixes: #27250.
2024-02-14 08:52:52 -08:00
Vector73 144c2c2f11 stream_settings: Add confirmation modal for changing privacy.
Fixes: #27916
2024-02-13 17:56:44 -08:00
evykassirer 925f5e8b67 drafts: Move some functions from draft_overlay_ui.
Preparation for an upcoming commit.
2024-02-13 15:20:48 -08:00
Karl Stolley 76220fdc2c features: Suppress plan-comparison subheadings. 2024-02-13 15:11:02 -08:00
Karl Stolley 873232d25e portico: Move comparison legend below plan tabs. 2024-02-13 15:11:02 -08:00
Karl Stolley f5fb9d76d0 features: Add rewritten heading content. 2024-02-13 15:11:02 -08:00
Karl Stolley 43ee8b2ce1 features: Adjust table columns for Cloud default. 2024-02-13 15:11:02 -08:00
Karl Stolley 04b94f6ad5 features: Swap in redesigned feature-comparison table. 2024-02-13 15:11:02 -08:00
vighneshbhat9945 f9ba4da012 stream-settings: Show indicator on notification settings.
In the Personal settings stream management panel,
when notification settings are changed, Saving/Saved
indicator are shown on personal settings heading instead
of notification settings heading.

Fix this issue by showing indicator on
notification settings heading.

Fixes: zulip#28728.
2024-02-13 14:47:42 -08:00
vighneshbhat9945 ab927cbb2a templates: Remove unwanted div. 2024-02-13 14:47:42 -08:00
vighneshbhat9945 4903870ec3 stream_settings: Remove duplication logic.
This commit addresses code duplication issue in
'stream_is_muted_changed()' which was redundantly
present in 'stream_setting_changed()'.

The changes ensure that the functionality is now centralized
and can be easily updated or extended in the future.
2024-02-13 14:47:42 -08:00
Lauryn Menard b275e9c4d6 stripe: Add billing portal for customer name and address.
Adds a link on the upgrade and billing pages that opens a stripe
billing portal for the customer to update their name and address
that will appear on invoices and receipts.

On the billing page, updating the credit card information will
no longer update the customer billing address, since they can
now do this directly through the billing portal. To be consistent
with the credit card form on the upgrade page, we still require
inputting a billing address for the card.

Note that, once an invoice is paid/complete, then changes to the
customer's name and address will not be applied to those invoices.
2024-02-13 14:18:38 -08:00
Lauryn Menard 29e8a63a39 stripe: Add name to stripe customer with payment method.
Set the name on the stripe customer object to the name on the
credit card when one is initially attached to a customer.

Prep commit to adding a stripe billing portal so that billing
admins will be able to update both the name and address that
appears on their stripe generated invoices and receipts.
2024-02-13 14:18:38 -08:00