Commit Graph

350 Commits

Author SHA1 Message Date
m-e-l-u-h-a-n 9d6cc8142b user groups: Add support for add_member and remove member events. 2023-02-07 15:12:56 -08:00
m-e-l-u-h-a-n 1f03042a48 user groups: Add support for removing user groups.
The new `#groups` overlay had no way for user groups to be deleted.
This commit adds UI support for removing user groups along with
adding support for live update of `#groups` overlay on remove
event for user groups.
2023-02-07 15:12:56 -08:00
m-e-l-u-h-a-n c0cd6f7f04 user groups: Add support for user group update event. 2023-02-07 15:12:56 -08:00
m-e-l-u-h-a-n 6147f2bd7a user groups: Add live update support for user_group add event.
We add live update support for user group events as part of
https://github.com/zulip/zulip/issues/19526.
This however has a few TODOs:
1. Deciding on how we want to sort the group list on left of
   #groups overlay.
2. How we highlight the newly created groups after it is added
   to the list.
These will be covered as we add support for more groups events.
2023-02-07 15:12:56 -08:00
Ujjawal Modi 836b9e483e settings: Improve permissions banners on Invitations panel.
Fixes #24158
2023-02-06 15:04:56 -08:00
Zixuan James Li b21f533af3 settings_users: Show all bots in organization settings.
We intended to show all the bots in the bots organization settings for
non-admin users as well. This switches from bot_data.all_user_ids() to
people.get_bot_ids() to get a full set of ids for all the bots in the
organization.

Because the source of data changes, "realm_user" instead of "realm_bot"
triggers the update of the bots list.

The code example (example4) is updated since we incorporate a side
effect into "realm_user"'s "add" op.

Note that while "realm_user" does not have a "delete" op, we still stop
redrawing bots on "relam_bot"'s "delete" op, because "delete" was only
triggered when the bot owner changes, the bot does not disappear from
the list of all bots.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-01-31 15:16:48 -08:00
Lauryn Menard 1a3b0edf4b account-settings: Disable deactivate account button when only owner.
Disables the deactivate account button in the user's account and
privacy settings tab if they are the only active organization owner.

Adds a tooltip when hovering on the deactivated button to let the
user know why the button is disabled.

The backend already returns an error for self account deactivation
requests if the user is the only organization owner.
2023-01-11 13:30:31 -08:00
Sahil Batra e6ec2badb5 message_edit: Make topic editing independent of allow_message_editing.
We now allow editing stream and topic of message even if
allow_message_editing if False using webapp given that is
allowed as per other topic and stream edit specific settings.

Fixes a part of #21739.
2022-12-13 23:11:50 -08:00
Aman Agrawal fbe9a9e539 left_side_userlist: Remove feature from frontend.
Fixes #23517.

While this feature was added to Zulip very early, it has been troubled
for most of that time; it never looked great visually, had a lot of
implementation complexity around resize.js, and has a weird model (a
setting that changes the UI only in certain window sizes).

This option is not commonly used; while a significant portion of users
have it enabled, many of them just don't use window sizes where it
actually has an effect. So it's not clear that it will be missed if
removed; we got very few bug reports when it was completely broken for
a few days after we first integrated the new left sidebar private
messages design.

Even with it no longer being broken, it does not work very well with
the addition of the new PMs section in the left sidebar. (Having two
scrollbars in the sidebar looks quite awkward.) The new private
messages section in the left sidebar also addresses some of the use
cases for always keeping the Users list always visible, even in narrow
windows.

This option is only removed from frontend for now. To make this
decision easily reversible, the backend code of this feature
is still kept.
2022-11-14 12:23:55 -08:00
Lauryn Menard d5b7551f09 frontend: Implement 'invisible mode' feature.
Transitions the frontend of the web app to no longer use the
user status `away` field for setting a user's activity status
to be 'unavailable' (which is now a deprecated way to access
a user's `presence_enabled` setting).

Instead we now directly use and update the user's `presence_enabled`
setting for this feature.

Renames frontend code related to the feature to `invisible_mode`
vs `away`.

We lose node test coverage in `user_status.js` because we are now
using `channel.patch` to send these user setting updates to the
server.

Removes the temporary updates to `server_events_dispatch.py` (and
related tests) made in a previous commit, since we no longer have
or need the `away_user_ids` set.
2022-09-23 12:27:54 -07:00
Lauryn Menard 5accbf38bf frontend: Update `away_user_ids` for presence_enabled update events.
Because the web app has the capacity to update the presence_enabled
user setting directly, we need to temporarily ensure that the
user profile popover is also updated to the correct text/value.

This can be removed once the web app client transitions to use
the presence_enabled setting for the 'invisible_mode' feature.
2022-09-23 12:27:54 -07:00
Tim Abbott 09c6ee6468 settings: Fix redraw_bots_list when adding/removing bots.
The ListWidget component needs to be provided with an updated list of
elements to display in order for it to show new items when
rerendering.
2022-09-22 12:31:28 -07:00
Raghav Luthra 4dad9fa158 user_settings: Add user setting to control the user list style.
Added a user_list_style personal user setting to the bottom of
Settings > Display settings > Theme section which controls the look
of the right sidebar user list.

The radio button UI includes a preview of what the styles look like.

The setting is intended to eventually have 3 possible values: COMPACT,
WITH_STATUS and WITH_AVATAR; the final value is not yet implemented.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
2022-09-09 16:30:54 -07:00
Kartik Srivastava 03d9418010 user_topics: Use user_topics page_param instead of muted_topics.
Since we are replacing muted_topics with user_topics, the web app
should now be using the user_topics page_param to construct the
muted_topics map. Also, the UI should now use the user_topic event
instead of muted_topics to handle topic updates.

This updates user_topics.js to use the new user_topics page_param to
initialize the muted topics map. This also replaces the "muted_topics"
clause in server_events_dispatch.js with a "user_topic" clause.
2022-08-29 17:24:08 -07:00
Purushottam Tiwari ff2db9c235 user groups: Rename settings_user_groups to settings_user_groups_legacy.
A preparatory commit to have legacy user group settings logic
as we move forward to redesign the user group settings.

This is done so that current user group settings are functional
while we are working on the redesign, and also to make it clear
that most of the code in this file will be deleted and developers
should avoid spending much time on it.
2022-08-23 17:30:39 -07:00
Aman Agrawal b8661b6633 message_lists: Add a function to return rendered message_lists.
This function returns home message_list and the current narrowed
message_list if it is different than home.
2022-08-18 12:30:30 -07:00
Tim Abbott 4a34b7d18e left-sidebar: Make Subscribe to more streams more informative.
The "Subscribe to more streams" widget has always had this tension
between "Subscribe" vs. "Create" in a way that felt like whatever we
wrote could be confusing. To address this, we enhance the component to
advertise whether additional existing streams that the user can
subscribe to actually exist or not.

- When the user has N>0 streams they can subscribe to, we display
"Browse N more streams".

- When the user has no streams they can subscribe to (i.e. they're
already susbcribed to all the ones they could join) but the user has
permission to create streams, we show a "Create a stream" link.

- If the user doesn't have permission to subscribe to or create any
streams, we don't show a link at all.

Fixes #21865.

Co-authored-by: Jai soni <jai_s@me.iitr.ac.in>
2022-08-15 12:32:43 -07:00
jai2201 d557933a76 dipatch: Remove a stale comment.
This stopped being true in 1d7d686.
2022-08-14 22:56:03 -07:00
Sahil Batra 8302337aa9 settings: Add tooltip for user read receipts setting.
We show tooltip for user read receipts setting mentioning
that the organization has disabled read receipts setting
when an organization does so. We hide the tooltip when
organization read receipts setting is enabled.

We also fix the alignment of "i" icons with label and headings
at various places by moving it 1 pixel below. There may be
some places where it is not fixed, but those will be fixed
separately.
2022-08-12 11:21:44 -07:00
Ganesh Pawar c6d636ef48 realm_domains_modal: Migrate modal to dialog_widget. 2022-07-07 14:56:45 -07:00
Sahil Batra dfd7902c77 user_groups: Rename subgroups fields to direct_subgroup_ids.
This commit renames subgroups and subgroup_ids field sent in user
group objects to direct_subgroup_ids for better readability.
2022-05-17 14:51:45 -07:00
Sahil Batra a5b3510cb3 user_groups: Add functions to update subgroups data on receiving events. 2022-05-05 13:48:01 -07:00
Lauryn Menard 44c9b788f9 settings: Add realm setting for Zulip communities directory.
Adds `want_advertise_in_communities_directory` to the realm model
to track organizations that give permission to be listed on such
a site / directory on zulip.com.

Adds a checkbox to the organization profile admin for
organizations to give permission to be advertised in the
Zulip communities directory.

Adds a help center article about the Zulip communities directory
and uses a shared intro documentation file to create sections in
the articles on creating an organization profile and moderating
open organizations.

Co-authored-by: Alya Abbott <alya@zulip.com>
2022-05-04 11:13:28 -07:00
Lauryn Menard 1292338537 frontend: Add `org_type` to realm settings updates and events.
Adds a drop-down menu for updating the organization type in the
`organization_profile_admin` page. Implements front end for
this setting to work / update like other organization profile,
notification and permissions settings.

One special note about this dropdown is that the listed options
should change once an organization has successfully set a type
other than 'unspecified' in the database. To accomplish this
the initial settings overlay build checks the realm_org_type
value in the page_params to select the correct options list,
and when the dropdown value is reset, either for update events
or for discarding changes, the page_params value is again used
to check for whether the 'unspecified' value should be present
as an option in the dropdown menu.

Adds basic node test for the `server_events_dispatch`.
Also adds a new help center documentation article for this
organization setting that is linked to in the UI.

Fixes #21692.
2022-04-26 16:29:12 -07:00
Raghav Luthra 22a5d008c1 user_settings: Add a setting to display names of users who reacted.
Added a setting to the bottom of Settings > Display settings > Theme section
to display the reacting users on a message when numnber of reactions are
small.

This is a preparatory commit for #20980.
2022-04-19 17:30:16 -07:00
Steve Howell c943447c6e emojis: Un-share the emoji.js module.
The mobile app was never able to use the shared
version of emoji.js, because, among other problems
with our code organization, the emoji.js module
is strongly based on a mutate-the-data paradigm
that doesn't play nice with React.  The way
that we mutate data and violate encapsuation
here is something that we would mostly want to fix
without even trying to shared code with mobile, so
subsequent commits will try to extract some pure
functions into a shared module.
2022-04-04 13:28:49 -07:00
Sahil Batra 630abf57d9 settings: Remove bot from "Active bots" list on changing owners.
On changing bot owner, "delete" event is sent to the previous
owner if previous owner is not an admin. We were ignoring the
"delete" event in webapp previously, but now we update the
bots page in personal settings to delete the bot. Note that
we do not remove the bot from the organization list of bots
currently, since list_widget does not support removing a
row as of now.

In case of previous owner being an admin, the previous owner
receives "update" event and thus the bots list is updated
from that event.

The code for ignoring "delete" event was added in fba2708bbc,
to basically avoid failed lookup for id in the organization
list of bots. I have tested and there cannot be a case of
a failed lookup in the list as per current code for list_widget
module and we are anyways safe after a reload or after closing the
overlay as the list will be updated correctly.

Discussion thread -
https://chat.zulip.org/#narrow/stream/321-settings-system/topic/List.20render.20.2315033

Fixes #20856.
2022-03-22 15:38:43 -07:00
Suyash Vardhan Mathur 20a97bdb05 events: Add functionality to mark messages as unread.
Co-authored-by: Steve Howell <showell@zulip.com>
Co-authored-by: Tim Abbott <tabbott@zulip.com>

This commit adds the backend functionality to
mark messages as unread through update_message_flags
with `unread` flag and `remove` operation.

We also manage incoming events in the webapp.

Tweaked by tabbott to simplify the implementation and add an API
feature level update to the documentation.

This commit was originally drafted by showell, and showell
also finalized the changes.  Many thanks to Suyash here for
the main work here, which was to get all the tests and
documentation work moving forward.
2022-03-15 18:00:35 -07:00
Tim Abbott 7ddefc68cc settings: render_alert_words_ui -> rerender_alert_words_ui.
Correctly specifying that this is a rerender function makes starting
with a `loaded` conditional make much more sense.
2022-02-25 17:33:11 -08:00
Sahil Batra 75d54206e6 buddy_list: Remove user from buddy_list immediately on deactivation. 2022-02-25 14:55:44 -08:00
Sahil Batra 6a64e1c442 settings_users: Call update_view_on_deactivate from server_events_dispatch.
This commit changes the code to call update_view_on_deactivate function
from server_events_dispatch.js on receiving the user/bot remove event
instead of having it repeatedly in the success_continuation method
of click handlers.

We also add check to make sure we return early if the relevant settings
page is not opened yet.
2022-02-25 14:55:44 -08:00
AnushaNathRoy 8da5edb7af status_emoji: Show status emoji in message_body.
Previously the emoji_status set by the user would only be seen a few
places, it was decided that it would be useful to show the
emoji_status in a few additional other places as well.

Use the status_emoji template to show the status emoji in the
message_body and also implement live update behavior.

With refactor and minor edits by Yash RE.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>
2022-02-11 13:02:56 -08:00
AnushaNathRoy e1fd47a692 status_emoji: Show status emoji in single PMs in the PM list.
Previously the emoji_status set by the user would only be seen in the
buddy list, it was decided that it would be useful to show the
emoji_status in other places as well.

As such this commit uses the status_emoji template to show the status
emoji in the PM list and also implements live update behavior.

With refactor and minor edits by Yash RE.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>
2022-02-12 01:06:52 +05:30
Anders Kaseorg 0b03628324 js: Shorten Object.prototype.hasOwnProperty.call to Object.hasOwn.
https://github.com/tc39/proposal-accessible-object-hasownproperty

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-24 09:57:09 -08:00
Yash Rathore 345616ad02
user_sidebar: Set personal presence dot based on the user's settings. (#20376)
If a user chooses to not broadcast their presence status to others, we
still show the user as available in their own user sidebar. Instead, one's
own availability should appear the same as it does for other users.

With tweaks from YashRE42: rebasing to use user_settings instead of
page_params, as introduced in the series of commits ending with
8755a76cf6, adding code comments and
moving the redraw call to `server_events_dispatch.js`.

Fixes part of #18846.  Further work is required to display the user's own idle
status properly to complete #18846.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>

Co-authored-by: Ganeshprasad Biradar <biradarganesh25@gmail.com>
2021-12-03 16:20:20 -08:00
Aman Agrawal 25ee6a795e compose: Never hide send button.
`Press Enter to send` used to hide `Send` button, we remove that
behaviour.

We show the current state of `Enter` hotkey action via text below
`Send` button which can toggle behaviour on click.
2021-12-02 15:11:15 -08:00
Sahil Batra 969bb2bf76 events: Live update stream-privacy choices on changing enable_spectator_access. 2021-12-01 13:01:19 -08:00
Sahil Batra a2ebb92649 settings: Add live-update code for updating stream privacy choices.
This commit adds code for live-updaing the stream-privacy choices
in stream creation form and privacy change modal on changing
"create_public_stream_policy", "create_private_stream_policy"
and "create_web_public_stream_policy".
2021-12-01 13:01:19 -08:00
Sahil Batra 17a955bf1e server_events_dispatch: Add create_web_public_stream_policy to realm_settings object. 2021-12-01 13:01:19 -08:00
Sahil Batra 0a949274e9 js: Rename night_mode.ts to dark_theme.ts. 2021-11-26 22:03:29 -08:00
Sahil Batra 828927b724 server_events_dispatch: Remove unnecessary 'realm_' prefix.
We do not have 'realm_' prefix to the settings used as keys
in realm_settings object, we directly use the setting name.

This commit removes the 'realm_' prefix from enable_spectator_access
setting.
2021-11-23 10:48:20 -08:00
Aman Agrawal 2a922409aa realm: Add option to enable/disable spectator login.
We restrict access of messages from web public streams if
anonymous login is disabled via `enable_spectator_access`.

Display of `Anonymous login` button is now controlled by
the value of `enable_spectator_access`.

Admins can toggle `enable_spectator_access` via org settings in UI.
2021-11-18 12:55:12 -08:00
Lauryn Menard 6046f94521 settings: Fix live `update_page` behavior for user settings.
Changes `update_page` to only update the modified user setting instead
of updating all of the user settings on the page. This is modeled on
the behavior for updates to the realm user default settings.

This is a follow up on feedback in #20070.
2021-11-10 13:03:20 -08:00
Lauryn Menard 73710e1cf0 user_settings: Add option to disable escape key navigation to default view.
Add `escape_navigates_to_default_view` as a bool setting in
UserBaseSettings model and implement it as a checkbox that toggles
the hotkey implementation of escape to the default view in the
advanced user display settings.

With /help/ documentation edits from Alya Abbott.

Fixes #20043.
2021-10-29 18:15:30 -07:00
Dinesh e2df0d171f user_settings: Add send_read_receipts setting.
This will be useful to let users enable/disable
sharing read receipts once we add that feature.

Note: Added "I've" to IGNORED_PHRASES in
tools/lib/capitalization.py to avoid capitalization
errors for the label text of this setting.
2021-10-07 17:46:05 -07:00
Dinesh 6d2b8f5ca9 user_settings: Add settings to configure sending typing notifications.
Note: These are not functional in enabling/disabling sending of
typing notifications with this commit.

Refactored the privacy settings update to keep the code less
duplicated along with making the addition of new settings easier.
2021-10-07 17:39:21 -07:00
Sahil Batra 8528914131 settings: Fix live update code for realm-level user defaults section.
Previously, on receiving udpate event of realm-level default setting,
we updated the whole page, but this might be problematic now in case
where user has edited settings in two subsections with save/discard
button still present and if user clicks on save button of one
subsection then the setting in other subsection also resets to its
original value as whole page is updated.

So, this commit changes the behavior to only update the changed
setting and not affecting other settings similar to what we do
in 'Organization settings' and 'Organization permissions' sections.

We also do not call 'settings_display.report_emojiset_change' when
realm-level default of emojiset setting is updated because we now
uses save/discard widget.
2021-10-07 10:16:28 -07:00
Ganesh Pawar fa928d5cd1 streams: Split setting for stream creation policy.
Users wanted a feature where they could specify
which users can create public streams and which users can
create private streams.

This splits stream creation code into two parts,
public and private stream creation.

Fixes #17009.
2021-10-01 10:26:42 -07:00
sahil839 909a3cde76 realm: Replace allow_message_deleting with delete_own_message_policy.
This commit replaces 'allow_message_deleting' boolean setting
with an integer setting 'delete_own_message_policy'. We have a
separate dropdown now for deciding which user-roles can delete
messages sent by themselves and the time-limit setting droddown
is different.

This new setting has two options - everyone and admins only. Other
options including moderators will be added further.

We also remove the "Never" option from the original time-limit
dropdown, as admins are always allowed to delete message. This
never option resembled the case of only admins being allowed to
delete but this state is now resembled by setting the dropdown
to "admins only" and we also disable the time-limit dropdown in
this case as admins are allowed to delete irrespective of limit.

Note, this setting is only for deleting messages sent by the
deleting user themselves, and only admins are allowed to delete
messages sent by others as before.
2021-09-30 14:59:31 -07:00
Sahil Batra c233ee9935 settings: Migrate twenty_four_hour_time setting to RealmUserDefault.
This commit removes the existing default_twenty_four_hour_time field in
Realm table which was used to set the twenty_four_hour_time setting of
new user on joining and instead we now use the twenty_four_hour_time
field of RealmUserDefault table for the same.

With some tweaks by tabbott to clarify the documentation.
2021-09-23 10:44:42 -07:00