Commit Graph

297 Commits

Author SHA1 Message Date
Julia Bichler fed866449d drafts: Add functionality to bulk delete drafts.
Fixes #19360.

Co-authored-by: Satyam Bansal <sbansal1999@gmail.com>
2023-08-11 15:54:17 -07:00
Satyam Bansal 0f0c52e096 drafts: Remove classes that had the same effect.
In commit 5edc8fc, abstract classes were added to the
drafts overlay, but the classes that were already there
were not removed. This resulted in the same styles being
applied twice.
2023-08-11 15:54:17 -07:00
Karl Stolley cd0fd49a83 copy_paste: Strip back tests to only test handler.
This gets us out of the brittle business of trying to mock a
complex event like "paste"--which mocking basically means we
are testing against the mock more than a real event.

The test name is also changed to clarify the handler being
tested.

See CZO discussion behind this change:
https://chat.zulip.org/#narrow/stream/43-automated-testing/topic/mocking.20browser.20events.3F/near/1615110
2023-08-09 15:35:14 -07:00
Hemant Umre a81715786c stream_settings: Add 'Default stream' option in edit stream UI.
This commit adds a 'Default stream for new users' checkbox in
the stream editing UI to allow admins to easily add or remove
a stream as the default stream for new users. Previously, this
functionality required navigating to separate menu.

Fixes a part of #24048.
2023-08-09 14:38:52 -07:00
evykassirer c3fe96af52 compose: Use stream id instead of stream name for composebox opts. 2023-08-07 17:08:59 -07:00
evykassirer 41b900c2c0 compose: Get stream name from id in create_message_object.
Since this is based off of the id now and doesn't try
to get a stream from a name (because stream is now
selected by a dropdown and not a free-form input field),
we can also remove the error handling for when the
stream name doesn't correspond to any streams.
2023-08-07 17:08:59 -07:00
evykassirer f190419bc9 composebox_typeahead: Get topics_seen_for stream id instead of name. 2023-08-07 17:08:59 -07:00
evykassirer d9edcba724 narrow_state: Rename stream() to stream_name() which is more accurate. 2023-08-07 17:08:59 -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
Prakhar Pratyush 3d5d434e71 settings: Add a saving-saved indicator to the 'SETTINGS/TOPICS' UI.
This commit adds a 'saving...' - 'saved' indicator to the
'SETTINGS/TOPICS' UI.

This improves the UX by reflecting that the changes are saved.
2023-08-06 13:55:21 -07:00
Anders Kaseorg 63c9296d53 tests: Fix direct mutation of ES modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 18:00:38 -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
Karl Stolley 73fbca7ae9
tests: Correct the spelling of 'caret'. 2023-08-03 12:54:43 -05:00
Anders Kaseorg 6632eca2dc stream_data: Use yield*.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-02 19:01:20 -07:00
Lalit Singh 2893685890 people: Revert to using `ignore_missing` parameter.
We revert to use `ignore_missing` parameter for `maybe_get_user_by_id`
function to avoid sending unnecessary `blueslip.error()` calls to
sentry.
2023-08-02 17:25:14 -07:00
Aman Agrawal 875d564f2d stream_settings: Migrate to new DropdownWidget.
Also, remove old DropdownListWidget since it is no longer used.
2023-07-27 14:10:08 -07:00
Aman Agrawal aa8e94ca6d settings_org: Migrate dropdowns to new DropdownWidget.
This also moves [Disabled] button inside the dropdown.
2023-07-27 14:10:08 -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
lapaz 5d5e1963b9 settings: Add "Copied" tooltip in bots/streams copy feedback.
This provides a bit nicer feedback to the user that the copy worked.

Fixes #26181
2023-07-24 13:21:43 -07:00
Hardik Dharmani cd24620c4a js: Rename top_left_corner.js to left_sidebar_navigation_area.js.
This provides a much clearer and more consistent codebase name for
this part of the app.

Fixes part of #25902.
2023-07-24 13:02:28 -07:00
Lalit 4a4d23a548 realm_playground: Remove `generated_pygments_data` parameter for
initialization function.

We are already importing `generated_pygments_data.json` directly in
`realm_playground.js` so there is no need to pass it via initialization
method.
2023-07-24 12:49:53 -07:00
Lalit 8c12494c16 realm_playground: Cut dependency on `typeahead_helper.js`. 2023-07-24 12:49:53 -07:00
Anders Kaseorg 7746e11486 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-21 15:58:42 -07:00
evykassirer 0652efc473 topic generator test: Use strings for stream name instead of numbers.
This function takes the stream name (a string) and using numbers
makes it seem like it's actually using a stream id, which is
confusing. This change adjusts `stream` to always be a string.
2023-07-21 14:19:55 -07:00
evykassirer 834f759e8b message view: Don't mark message as read in mentions view. 2023-07-21 13:10:07 -07:00
Alex Vandiver ba7492a314 web: Do not assume error responses are valid, or our, JSON.
Partially fixes #24815.
2023-07-19 16:18:31 -07:00
Alex Vandiver 7efe989a72 web: Switch from JSON.parse(xhr.responseText) to xhr.responseJSON. 2023-07-19 16:18:31 -07:00
Alex Vandiver d05a1e9efa web: Remove nonsense round-trip through JSON.parse() + JSON.stringify(). 2023-07-19 16:18:31 -07:00
Alex Vandiver d05a9d4000 reactions: Do not send server error reports for duplicate requests. 2023-07-19 16:18:31 -07:00
Prakhar Pratyush 1a2831059d notifications: Enable audible notifications for the FOLLOWED topic.
This commit adds support for triggering audible desktop
notifications when:

* A message is sent to a followed topic with the global user setting
'enable_followed_topic_audible_notifications' enabled.

* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 67d4334bf1 notifications: Enable desktop notifications for the FOLLOWED topic.
This commit adds support for triggering visual desktop
notifications when:

* A message is sent to a followed topic with the global user setting
'enable_followed_topic_desktop_notifications' enabled.

* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 93a18b999a settings: Update SETTINGS/TOPICS panel to include followed topics.
This commit updates the existing 'Topics' settings UI
to add support for followed topics.

Changes:
- Add "Followed" as the first option in the topic status dropdowns.
- Modify the intro text.
- Replace the "Learn more." link with a question mark linking to
'/help/mute-a-topic' on the "Topic settings" heading.

The changes are visible in the development environment only.

Fixes #25918.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 08c952a2a3 user_topics: Add the missing node tests.
This commit adds the missing node tests for the case
when the visibility policy is UNMUTED.

This should have been included in c526543.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 32b201d5e0 user_topics: Rename 'muted_topics_ui' to 'user_topics_ui'.
This commit renames the file 'muted_topics_ui.js' to
'user_topics_ui.js', as we also support visibility policies
other than MUTED.
2023-07-17 17:39:17 -07:00
evykassirer d293e869bd search: Bold search operands in the first search result.
Specifically when it's the last operand of the search
filter. This makes the first line of search results
more consistent with the lines that come after.
2023-07-17 17:19:08 -07:00
evykassirer 8f5305a4ce search: Create a template for search descriptions. 2023-07-17 17:19:08 -07:00
evykassirer 6346110b56 search: Remove unused base_query variable. 2023-07-17 17:19:08 -07:00
evykassirer 7116526492 compose: Use compose_state.stream_id when name isn't needed.
This partially fixes #25742.
2023-07-17 16:30:39 -07:00
Lalit d58085dde2 list_widget: Check length of JQuery collection instead of collection
itself.

We were checking for the undefined value of `$html_item` but this
variable is always true since `$.find` never returns an undefined value
and it returns a JQuery collection instead.

So we need to check the length of that JQuery collection here to make
sure that the condition works as expected.
2023-07-17 11:31:51 -07:00
Lalit ed7588152e list_widget: Remove over defensive validation code.
After migrating to TypeScript, we don't need to manually validate the
configuration passed to the `ListWidget`, that's what typescript complier
will do for us, hence I removed `validate_opts` and `valid_filter_opts`
functions.
2023-07-17 11:31:51 -07:00
Lalit b51bdd33bb ts: Migrate `list_widget` to TypeScript. 2023-07-17 11:31:51 -07:00
Lalit b04dfd8c29 list_widget: Explicitly pass generic sort functions to the list widget.
This is a prep commit for typescript migration of this module. In this commit
I made all the users of ListWidget pass generic sort functions like 'alphabetic'
and 'numeric' explicitly to avoid type conversions which we may need when moving
to typescript, also it simplifies our `set_sorting_function` a bit more.
2023-07-17 11:31:51 -07:00
Lalit 3720fd5c76 list_widget: Make `get_item` option required and pass a default where needed.
This is a prep commit for moving towards typescript migration of this module.
We should make `get_item` required on `list_widget` because its intended to be
used with a set of keys and then hydrate the keys lazily. Also this will help
us to avoid writing messy if-conditions while filtering and sorting and make
our life much easier when we migrate to TypeScript.

I added a `default_get_item` function which is just n identity function and
also refactored some code to make use of default get item.
2023-07-17 11:31:51 -07:00
Lalit 61d4670f9a user_group_pill: Add test coverage for `append_user_group`. 2023-07-17 10:38:24 -07:00
Lalit e06726a5cf peer_data: Remove over defensive `assert_number` function.
Removes the `assert_number` over defensive function which was being used
for validating the type of `stream_id` but now that this module is
converted to TypeScript we do not need this function anymore since
typescript compiler will do the type checking for us.
2023-07-17 10:37:29 -07:00
Hemant Umre 30ab2781b1 left_sidebar: Fix exception exiting "more topics".
The `stream_list.build_stream_list()` function is responsible for
rendering the stream list in the left sidebar. Previously, it uses
`topic_list.clear()` to clear the `active_widgets` that tracks active
stream(s) in the left sidebar. This led to a bug where rendering stream
list after adding or removing a stream through `build_stream_list()`
while a stream was zoomed in ("more topics" clicked) didn't fully exit
the "more topics" view. So clicking "BACK TO STREAMS" throws an exception
with the message "Error: Unexpected number of topic lists to zoom out"
because `active_widgets`, cleared by `topic_list.clear()`, became
inaccessible.

To address this issue, instead of clearing the topics list with
`topic_list.clear()`, the code now ensures the closure of the zoomed
stream by using `topic_zoom.clear_topics()`. This change ensures a
proper exit from the "more topics" view and avoids the exception.

Fixes #25670.
2023-07-17 10:13:53 -07:00