Commit Graph

280 Commits

Author SHA1 Message Date
Anders Kaseorg 5387e56da7 settings_config: Add generalize_stream_notification_setting table.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-25 13:02:48 -07:00
madrix01 c1b5021d84 stream_list: Sort muted to end of sections and add labels.
The stream list left sidebar currently has 3 sections:
* Pinned (+ Muted pinned streams)
* Active (+ Muted active streams)
* Inactive streams

Previously, these sections were separated by horizontal lines, which
did not provide an easy way to discern why there were sections. We add
labels to these section dividers to help with this.

Additionally, within each section, we now sort all muted streams to
the bottom, so that they general minimal clutter.

Fixes #19812.
2022-08-06 21:59:23 -07:00
Sahil Batra 18dda7b485 message_edit: Do not show streams to which user cannot post.
We do not show the streams to which user cannot post in the dropdown
list widget for moving messages between streams.
2022-07-22 17:19:40 -07:00
NerdyLucifer 1eb1aa70ed stream_settings: Improve stream_post_policy_values order, description.
In "stream_data.js/stream_post_policy_values", change, the object to match
the following order and description of these policies:

1. Everyone [Default]
2. Admins, moderators and full members
3. Admins and moderators
4. Admins only

This sorts from least to most restrictive.
2022-03-10 15:11:06 -08:00
Julia Bichler 24673b7a69 settings: Grey out muted streams in personal settings.
Muted streams are now greyed out in the personal settings,
also changes to the notification settings of a muted stream are
not possible anymore.

Also, add a bell-slash icon after the stream name of muted streams,
clicking on it unmutes the stream.

Fixes #19780.
2022-03-03 14:51:15 -08:00
Austin Riba 403310a9e2 hash_util: Move stream_id_to_slug to shared.
Move stream_data.id_to_slug to internal_url, making it shareable. The
function has been renamed to stream_id_to_slug to reflect that it
operates on a stream id.
2022-03-01 18:14:31 -08:00
Austin Riba 980fd2f976 streams: Fix malformed stream name slugs.
The stream_data.id_to_slug and stream_data.name_to_slug
functions mistakenly used Javascript's String.replace method,
this commit changes it to use String.replaceAll, the result
being slugs generated from streams with names greater than
2 words are now properly formatted.
2022-03-01 18:14:31 -08:00
Aman Agrawal 0bde50b851 stream_data: Set can_toggle_subscription to false for spectator. 2022-01-31 16:39:17 -08:00
Anders Kaseorg 90e202cd38 docs: Consistently hyphenate “web-public”.
In English, compound adjectives should essentially always be
hyphenated.  This makes them easier to parse, especially for users who
might not recognize that the words “web public” go together as a
phrase.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-28 17:45:45 -08:00
Eeshan Garg c30458e174 streams: Add notifications for posting policy changes.
An explanatory note on the changes in zulip.yaml and
curl_param_value_generators is warranted here. In our automated
tests for our curl examples, the test for the API endpoint that
changes the posting permissions of a stream comes before our
existing curl test for adding message reactions.

Since there is an extra notification message due to the change in
posting permissions, the message IDs used in tests that come after
need to be incremented by 1.

This is a part of #20289.
2022-01-10 18:29:04 -08:00
Sahil Batra 1049867485 streams: Reorder stream-privacy choices in UI.
This commit moves 'Web public' option to top in
the stream privacy choices in stream creation
form and changing privacy modal.
2021-12-07 11:44:45 -08:00
Tim Abbott 9875c9be1b stream_data: Fix web_public option defintion being development only.
The availability of this option is now controlled by fancier logic in
stream_settings_ui.js, but we neglected to remove this
development_environment guard when doing so, resulting in stream
creation being broken in production environments (because the
JavaScript code depended on this value being available).
2021-12-01 14:08:16 -08:00
Tim Abbott b9629d72a9 stream_data: Extend comments for can_toggle_subscription.
The previous comments were a bit simple and I wanted to add an
important detail about how deactivated streams interact with this
feature.

Fixes #20262.
2021-11-24 17:44:43 -08:00
Tim Abbott a7898ed305 stream_data: Rename id_is_subscribed to is_subscribed. 2021-11-22 15:44:30 -08:00
Tim Abbott 53d9797044 stream_data: Rename is_subscribed to is_subscribed_by_name.
Generally the stream_data module aims to do lookup by ID, not name,
wherever possible, so we should represent that in the function names.
2021-11-22 15:44:30 -08:00
Tim Abbott 3f4d66109b stream_data: Rename get_invite_only helper method.
Since this library is intended to primarily work by user ID, we want
to name all methods that do lookups by stream name explicitly.
2021-11-22 15:32:14 -08:00
Aman Agrawal d9338a68d1 compose: Show globe icon for web public streams.
Fixes #20285.
2021-11-22 15:31:22 -08:00
Sahil Batra 6aa5b3be51 settings: Fix streams incorrectly appearing in notification settings.
There is a bug when a newly created stream appears in the notification
settings table if user changes any setting in 'Streams' row of the
table even though user has not changed the notification setting of
the stream and thus the stream should follow the global-level values.

The stream is correctly not added to the table if user changes the
setting after reloading once after creating the stream.

The bug is due to the notification settings of the new-stream being
set to the user's global settings at time of stream creation which
are not overridden since the stream-creation event contains only
stream fields and not subscription fields. And the newly created
stream is not present in the table after reload because during
initialization of the client-level data structures the notification
setting values are overridden by the values stored in server.

This commit fixes create_sub_from_server_data code to initially have
the notification settings set as null in the sub object which are
overridden by the correct value during initialization. This keeps
the notification setting values as null just after stream creation.

Fixes #19933.
2021-10-08 10:31:20 -07:00
Aman Agrawal 8c50a08066 stream_edit: Live update UI when a stream becomes web public. 2021-09-21 10:22:33 -07:00
Tim Abbott e7c62c4190 stream_data: Rephrase descriptions of stream permissons.
The previous phrasing used incorrect terminology (E.g. "stream
members", not "stream subscribers", which is really confusing given
that we have a "member" role which is also relevant in this text).
2021-09-14 11:29:32 -07:00
Aman Agrawal 7c8e19758a stream_data: Add web_public as a stream privacy mode.
Show web_public descriptions for web public streams.

(Temporarily limited to development environments, since this feature
is not available yet).
2021-09-14 11:12:47 -07:00
Sahil Batra 998d710275 frontend: Add new user_settings module for user's settings.
We add a new user_settings module similar to page_params
module in frontend and use it to access user's personal
settings instead of page_params.
2021-08-01 15:30:17 -07:00
m-e-l-u-h-a-n 433452a9b3 streams: Add function to get subscribed streams of a user.
We show only those streams whose subscribers can be seen by
logged-in user in subscribers list in stream edit page.
2021-06-17 17:57:20 -07:00
sahil839 f5f6617476 streams: Add frontend code for moderators only stream post policy. 2021-05-01 08:21:50 -07:00
Steve Howell 173ce9a3fc refactor: Use sub_store for get/validation.
This reduces the complexity of our dependency graph.

It also makes sub_store.get parallel to message_store.get.
For both you pass in the relevant id to get the
full validated object.
2021-04-15 17:26:17 -07:00
Steve Howell d2bbb7d521 refactor: Extract sub_store module.
This is a prep commit to break dependencies.

The sub_store module is a thin layer on top of
our map of stream_id -> sub.
2021-04-15 17:26:17 -07:00
Anders Kaseorg 2004a85fb1 i18n: Automatically convert remaining JavaScript messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Steve Howell d50462568b refactor: Avoid update_calculated_fields() calls.
This change should make live-update code less brittle,
or at least less cumbersome.

Instead of having to re-compute calculated fields for
every change to a stream message, we now just compute
the fields right before we render stream settings UI.
2021-04-05 09:52:19 -07:00
Steve Howell 5624ed2afe refactor: Extract stream_data.clean_up_description().
We use this in the few places where update_calculated_fields()
could plausibly be dealing with a new rendered description.
2021-04-05 09:52:19 -07:00
Steve Howell 430fadfb0b refactor: Extract stream_data.can_subscribe_others(). 2021-04-05 09:52:19 -07:00
Steve Howell 36fd76dc20 refactor: Extract can_view_subscribers().
We also remove some needless uses of the calculated
field in the node tests.
2021-04-05 09:52:19 -07:00
Steve Howell ea972569a3 refactor: Extract stream_data.can_change_permissions(). 2021-04-05 09:52:19 -07:00
Steve Howell b27ff978c7 minor: Extract can_preview() helper. 2021-04-05 09:52:19 -07:00
Steve Howell 93471ed3e4 refactor: Extract can_toggle_subscription(sub).
We don't want to rely so much on calculated fields,
and the `should_display_subscription_button` name
is a bit misleading in certain contexts.
2021-04-05 09:52:19 -07:00
Steve Howell 4380fe4eaf refactor: Extract stream_settings_data.
This is mostly a pure code move.

In passing I remove an unneeded call to
update_calculated_fields in the dispatch code,
plus some tests that don't need them.
2021-04-05 09:52:19 -07:00
Mateusz Mandera 82b43a8cfe streams: Use "archive stream" phrasing instead of "delete stream".
The previous phrasing was misleading in relation to what the action
actually does.
2021-04-02 22:06:48 -07:00
Steve Howell e08bd9b1af refactor: Move all_topics_in_cache.
This is a pure code move.

The diff is bit cluttered by the necessity
to add with_field when we moved the test.
2021-03-29 14:53:57 -07:00
Steve Howell d9e4c2285c refactor: Break stream_data's dep on stream_color.
We simply lift the DEFAULT_COLOR constant to stream_data.
2021-03-28 15:55:55 -07:00
Anders Kaseorg 38ffd47b90 js: Convert static/js/page_params.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
Anders Kaseorg bb1b2048bd js: Convert static/js/i18n.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
Anders Kaseorg 6de39ae92d js: Clean up typeof … === "undefined" checks.
The only reason to use typeof foo === "undefined" is when foo is a
global identifier that might not have been declared at all, so it
might raise a ReferenceError if evaluated.  For a variable declared
with const or let or import, a function argument, or a complex
expression, simply foo === undefined is equivalent.

Some of these conditions have become impossible and can be removed
entirely, and some can be replaced more idiomatically with default
parameters (note that JavaScript does not share the Python misfeature
of evaluating the default parameter at function declaration time).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-24 13:15:01 -07:00
Anders Kaseorg 3ef6f6e2e2 js: Convert static/js/blueslip.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-17 08:47:15 -04:00
Anders Kaseorg 7a67c06581 js: Convert static/js/message_list.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg c94ffb5319 js: Convert static/js/hash_util.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg ad3390e395 js: Convert static/js/stream_topic_history.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 245d6c3a3e js: Convert static/js/stream_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg d81ba3698f js: Convert static/js/stream_color.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg 374dfc2fda js: Convert static/js/color_data.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Steve Howell d67cc2d080 slugs: Fix regex for legacy stream slugs.
This prevents a bug where we interpret "2something"
as a modern slug instead of a legacy stream name.

The bug was probably somewhat unlikely to happen in
practice, since it only manifests if 2 is an actual
stream_id.
2021-02-10 14:37:34 -08:00
Steve Howell 17ea215f18 minor: Remove peer_data.clear(). 2021-02-03 15:23:17 -08:00