Commit Graph

36 Commits

Author SHA1 Message Date
Ujjawal Modi 9a96d19315 invites: Frontend changes for adding the new realm setting.
This commit does the changes in frontend required
for adding the new setting `Who can create multiuse invite link.`

Fixes #15159.
2023-09-07 14:21:01 -07:00
Sahil Batra ae72151ec1 streams: Pass stream_weekly_traffic field in stream objects.
This commit adds code to pass stream traffic data using
the "stream_weekly_traffic" field in stream objects.

We already include the traffic data in Subscription objects,
but the traffic data does not depend on the user to stream
relationship and is stream-only information, so it's better
to include it in Stream objects. We may remove the traffic
data and other stream information fields for Subscription
objects in future.

This will help clients to correctly display the stream
traffic data in case where client receives a stream
creation event and no subscription event, for an already
existing stream which the user did not have access to before.
2023-08-06 18:06:42 -07:00
Anders Kaseorg 64c973d8ec namespace: Tighten override_rewire old_value check.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 18:00:38 -07:00
Anders Kaseorg 529d35c530 namespace: Clean up template_path manipulation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 14:38:37 -07:00
Anders Kaseorg 6632eca2dc stream_data: Use yield*.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-02 19:01:20 -07:00
Aman Agrawal 6efcb7a349 dropdown_widget: Refactor to use Class. 2023-07-27 14:10:08 -07:00
Ujjawal Modi fbcc3b5c84 user_groups: Rename `can_mention_group_id` parameter.
Earlier the API endpoints related to user_group accepts and returns a
field `can_mention_group_id` which represents the ID
of user_group whose members can mention the group.

This commit renames this field to `can_mention_group`.
2023-07-25 18:33:04 -07:00
Ujjawal Modi c8bcb422f5 streams: Rename `can_remove_subscribers_group_id` parameter.
Earlier the API endpoints related to streams accepts and returns a
field `can_remove_subscribers_group_id` which represents the ID
of user_group whose members can remove subscribers from stream.

This commit renames this field to `can_remove_subscribers_group`.
2023-07-25 18:33:04 -07:00
Zixuan James Li 000761ac0c realm_playgrounds: Replace url_prefix with url_template.
Dropping support for url_prefix for RealmPlayground, the server now uses
url_template instead only for playground creation, retrieval and audit
logging upon removal.

This does the necessary handling so that url_template is expanded with
the extracted code.

Fixes #25723.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-07-24 17:40:59 -07:00
Anders Kaseorg 407c16fc77 eslint: Expand no-unused-vars check to all function parameters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-02 16:16:38 -07:00
Sahil Batra e6accb0ad9 user_groups: Add can_mention_group_id field to UserGroup objects.
This commit adds code to include can_mention_group_id field to
UserGroup objects passed with response of various endpoints
including "/register" endpoint and also in the group object
send with user group creation event.

Fixes a part of #25927.
2023-06-30 17:28:33 -07:00
Daniil Fadeev daab1d4265
compose_banner: Remove uploads banners when clearing compose box.
Upload banners were not cleared after closing compose box, which meant
that they would remain present in a paused state after compose was reopened.

https://chat.zulip.org/#narrow/stream/9-issues/topic/Incomplete.20Upload.20banner.20remains.20on.20closing.20compose/near/1582602
2023-06-23 11:45:04 -07:00
Lalit 1f4dd0705d page_params: Make seperate `page_params` for billing module.
This commit introduces a seperate `page_params` file for billing module
since we only use certain page_params in billing module only that it does
not make sense to include them in the main `page_params.ts`.

Also introduced `zpage_billing_params` for proper testing new `page_params`
in billing module.
2023-06-23 11:42:29 -07:00
Tim Abbott c961ad4f37 notifications: Inline handle_global_notification_updates. 2023-06-05 21:57:35 -07:00
Daniil Fadeev 209e9edd9d compose: Add container parameter to functions.
This commit introduces a new container parameter for functions that
can be used for both compose and edit mode. It provides the function
with information about the context in which it is being used.
2023-05-09 23:05:04 -07:00
Alex Vandiver 5d97dbf8b3 zblueslip: Show chained causes in unexpected messages. 2023-05-09 13:16:28 -07:00
Alex Vandiver 3ab22233f0 sentry: Add tracing extensions when Sentry is not enabled. 2023-05-09 13:16:28 -07:00
evykassirer 9ea6eca253 compose: Move cursor to end of topic input after stream selection.
Fixes #25321.
2023-05-02 12:49:31 -07:00
Aman Agrawal 7d373c54a9 scheduled_mesages: Use events to update scheduled message data.
This also allows to display scheduled message overlay without
fetching any data.
2023-05-01 22:45:03 -07:00
evykassirer 695946746e compose: Rename stream selection widget to "select_recipient".
Previously this dropdown was only for selecting streams, but
soon it will also be for switching to a private message. This
name helps it be clearer that the dropdown is more general
purpose.
2023-04-27 17:04:19 -07:00
N-Shar-ma 9f2ef69c71 compose: Add banner for unmuting the muted topic a message is sent to.
We add a new banner informing the user if and when they send a message
to a muted topic / stream. It also has a button to unmute the topic.

Fixes: #24246.
2023-04-25 16:16:47 -07:00
evykassirer 8a2455a294 compose: Change stream field in composebox to be a dropdown.
Fixes #11832

This lets the user see more options than the three that appear
in the typeahead menu, and prevents them from inputting invalid
stream names.

This change replaces the input field with the dropdown, and
updates everything that referred to the classnames of the old
input field, so that they now get the data they need from the
new dropdown.
2023-04-20 16:09:55 -07:00
Zixuan James Li 268f858f39 linkifier: Support URL templates for linkifiers.
This swaps out url_format_string from all of our APIs and replaces it
with url_template. Note that the documentation changes in the following
commits  will be squashed with this commit.

We change the "url_format" key to "url_template" for the
realm_linkifiers events in event_schema, along with updating
LinkifierDict. "url_template" is the name chosen to normalize
mixed usages of "url_format_string" and "url_format" throughout
the backend.

The markdown processor is updated to stop handling the format string
interpolation and delegate the task template expansion to the uri_template
library instead.

This change affects many test cases. We mostly just replace "%(name)s"
with "{name}", "url_format_string" with "url_template" to make sure that
they still pass. There are some test cases dedicated for testing "%"
escaping, which aren't relevant anymore and are subject to removal.
But for now we keep most of them as-is, and make sure that "%" is always
escaped since we do not use it for variable substitution any more.

Since url_format_string is not populated anymore, a migration is created
to remove this field entirely, and make url_template non-nullable since
we will always populate it. Note that it is possible to have
url_template being null after migration 0422 and before 0424, but
in practice, url_template will not be None after backfilling and the
backend now is always setting url_template.

With the removal of url_format_string, RealmFilter model will now be cleaned
with URL template checks, and the old checks for escapes are removed.

We also modified RealmFilter.clean to skip the validation when the
url_template is invalid. This avoids raising mulitple ValidationError's
when calling full_clean on a linkifier. But we might eventually want to
have a more centric approach to data validation instead of having
the same validation in both the clean method and the validator.

Fixes #23124.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-04-19 12:20:49 -07:00
Joelute 938b7917d3 user_settings: Add option to not mark messages as read on scroll.
These changes introduces an new user option where it allows
users read messages and scroll through their feed without
marking those messages as read.

Fixes: #22804.
2023-04-18 18:32:02 -07:00
Alex Vandiver 2d5c678614 blueslip: Only show in dev mode, or report to Sentry.
This removes the production reporting to `/json/report/error` upon
`blueslip.error`, and replaces it with reporting to Sentry, if
enabled.  Sentry provides better reporting and grouping for exceptions
than the email- and `#errors`-reporting provided by the
`/json/report/error` endpoint.

The development behaviour of rendering `blueslip.error` messages and
stacktraces immediately, and stopping execution, is preserved.

To better chain exception information, the whole previous exception is
passed to `blueslip.error`, not just the stack, and the second
parameter is formalized to be an object to map to Sentry's "context"
concept.
2023-04-13 14:59:58 -07:00
Alex Vandiver 7152278463 blueslip: Remove unused blueslip.timings store.
This was a write-only store which was never accessed.
2023-04-13 14:59:58 -07:00
Alex Vandiver 6882ec8087 blueslip: Remove unused preview_node.
It is unused, and an XSS waiting to happen if misused.
2023-04-13 14:59:58 -07:00
Anders Kaseorg b533cd979e templates: Enable Handlebars strict mode.
https://handlebarsjs.com/api-reference/compilation.html

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-05 15:23:54 -07:00
Sahil Batra 6582374178 server_events_dispatch: Fix live-update of email_address_visibility. 2023-03-27 09:02:00 -07:00
Sahil Batra 734d1848c0 server_events_dispatch: Update bots list only if needed.
After b21f533af, we now update the organization bots
list on receiving realm_user events since non-admins
can also see bots not owned by them in the list.

But the functions to update bot list should be called
only for bot users and not for others, otherwise it
results in an error.

This can be reproduced by first opening the organization
bots list and then just updating the name of the user.
Calling `redraw_bots_list` on receiving "realm_user/add"
event for non bot users will not raise any error but
still we avoid redrawing the whole list when not required.

This commit fixes the code to call functions to update
bot list only when the event is received for a bot.
2023-03-02 13:26:20 -08:00
Anders Kaseorg 2a70c11c5f eslint: Fix unicorn/prefer-spread.
This was initially disabled for IE/Babel-related reasons that no
longer apply.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-02 12:16:56 -08:00
Anders Kaseorg 9d514a29d1 zjquery: Make FakeElement iterable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-02 12:16:56 -08:00
Anders Kaseorg a2ea5e8598 test-js-with-node: Fix source maps for coverage.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-24 13:54:29 -08:00
Anders Kaseorg 0ef8e88b17 webpack: Move webpack configuration to web.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-24 06:35:58 -08:00
Anders Kaseorg 23fd4f95f4 web/tests: Don’t rely on current directory.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-24 06:35:58 -08:00
Anders Kaseorg cea1119423 node_tests: Move to web/tests.
This lets us simplify the long-ish ‘../../static/js’ paths, and will
remove the need for the ‘zrequire’ wrapper.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-23 16:04:17 -08:00