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.
This commit is contained in:
Raghav Luthra 2022-04-08 19:34:22 +05:30 committed by Tim Abbott
parent 6c6986e2d3
commit 22a5d008c1
12 changed files with 110 additions and 1 deletions

View File

@ -32,6 +32,7 @@ export type RealmDefaultSettingsType = {
realm_name_in_notifications: boolean; realm_name_in_notifications: boolean;
starred_message_counts: boolean; starred_message_counts: boolean;
translate_emoticons: boolean; translate_emoticons: boolean;
display_emoji_reaction_users: boolean;
twenty_four_hour_time: boolean; twenty_four_hour_time: boolean;
wildcard_mentions_notify: boolean; wildcard_mentions_notify: boolean;
}; };

View File

@ -606,6 +606,7 @@ export function dispatch_normal_event(event) {
"timezone", "timezone",
"twenty_four_hour_time", "twenty_four_hour_time",
"translate_emoticons", "translate_emoticons",
"display_emoji_reaction_users",
"starred_message_counts", "starred_message_counts",
"send_stream_typing_notifications", "send_stream_typing_notifications",
"send_private_typing_notifications", "send_private_typing_notifications",
@ -686,6 +687,10 @@ export function dispatch_normal_event(event) {
// Rerender buddy list status emoji // Rerender buddy list status emoji
activity.build_user_sidebar(); activity.build_user_sidebar();
} }
if (event.property === "display_emoji_reaction_users") {
message_live_update.rerender_messages_view();
}
if (event.property === "escape_navigates_to_default_view") { if (event.property === "escape_navigates_to_default_view") {
$("#go-to-default-view-hotkey-help").toggleClass("notdisplayed", !event.value); $("#go-to-default-view-hotkey-help").toggleClass("notdisplayed", !event.value);
} }

View File

@ -496,6 +496,12 @@ export const display_settings_labels = {
defaultMessage: "Convert emoticons before sending (<code>:)</code> becomes 😃)", defaultMessage: "Convert emoticons before sending (<code>:)</code> becomes 😃)",
}), }),
), ),
display_emoji_reaction_users: new Handlebars.SafeString(
$t_html({
defaultMessage:
"Display names of reacting users when few users have reacted to a message.",
}),
),
escape_navigates_to_default_view: $t({defaultMessage: "Escape key navigates to default view"}), escape_navigates_to_default_view: $t({defaultMessage: "Escape key navigates to default view"}),
}; };

View File

@ -32,6 +32,7 @@ export type UserSettingsType = {
realm_name_in_notifications: boolean; realm_name_in_notifications: boolean;
starred_message_counts: boolean; starred_message_counts: boolean;
translate_emoticons: boolean; translate_emoticons: boolean;
display_emoji_reaction_users: boolean;
twenty_four_hour_time: boolean; twenty_four_hour_time: boolean;
wildcard_mentions_notify: boolean; wildcard_mentions_notify: boolean;
send_stream_typing_notifications: boolean; send_stream_typing_notifications: boolean;

View File

@ -73,6 +73,13 @@
label=settings_label.translate_emoticons label=settings_label.translate_emoticons
prefix=prefix}} prefix=prefix}}
{{#if page_params.development_environment }}
{{> settings_checkbox
setting_name="display_emoji_reaction_users"
is_checked=settings_object.display_emoji_reaction_users
label=settings_label.display_emoji_reaction_users
prefix=prefix}}
{{/if}}
</div> </div>
<div class="advanced-settings {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}"> <div class="advanced-settings {{#if for_realm_settings}}org-subsection-parent{{else}}subsection-parent{{/if}}">

View File

@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 6.0 ## Changes in Zulip 6.0
**Feature level 125**
* [`POST /register`](/api/register-queue), [`PATCH
/settings`](/api/update-settings), [`PATCH
/realm/user_settings_defaults`](/api/update-realm-user-settings-defaults):
Added new `display_emoji_reaction_users` display setting,
controlling whether to display the names of users with emoji reactions.
Feature levels 123-124 are reserved for future use in 5.x maintenance Feature levels 123-124 are reserved for future use in 5.x maintenance
releases. releases.

View File

@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
# Changes should be accompanied by documentation explaining what the # Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md, as well as # new level means in templates/zerver/api/changelog.md, as well as
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`. # "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 122 API_FEATURE_LEVEL = 125
# Bump the minor PROVISION_VERSION to indicate that folks should provision # Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump # only when going from an old version of the code to a newer version. Bump

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.12 on 2022-04-16 13:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0388_preregistrationuser_created_user"),
]
operations = [
migrations.AddField(
model_name="realmuserdefault",
name="display_emoji_reaction_users",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="userprofile",
name="display_emoji_reaction_users",
field=models.BooleanField(default=True),
),
]

View File

@ -1467,6 +1467,7 @@ class UserBaseSettings(models.Model):
fluid_layout_width: bool = models.BooleanField(default=False) fluid_layout_width: bool = models.BooleanField(default=False)
high_contrast_mode: bool = models.BooleanField(default=False) high_contrast_mode: bool = models.BooleanField(default=False)
translate_emoticons: bool = models.BooleanField(default=False) translate_emoticons: bool = models.BooleanField(default=False)
display_emoji_reaction_users: bool = models.BooleanField(default=True)
twenty_four_hour_time: bool = models.BooleanField(default=False) twenty_four_hour_time: bool = models.BooleanField(default=False)
starred_message_counts: bool = models.BooleanField(default=True) starred_message_counts: bool = models.BooleanField(default=True)
COLOR_SCHEME_AUTOMATIC = 1 COLOR_SCHEME_AUTOMATIC = 1
@ -1603,6 +1604,7 @@ class UserBaseSettings(models.Model):
**notification_setting_types, **notification_setting_types,
**dict( **dict(
# Add new general settings here. # Add new general settings here.
display_emoji_reaction_users=bool,
escape_navigates_to_default_view=bool, escape_navigates_to_default_view=bool,
send_private_typing_notifications=bool, send_private_typing_notifications=bool,
send_read_receipts=bool, send_read_receipts=bool,

View File

@ -7962,6 +7962,20 @@ paths:
schema: schema:
type: boolean type: boolean
example: true example: true
- name: display_emoji_reaction_users
in: query
description: |
Whether to display the names of reacting users on a message.
When enabled, clients should display the names of reacting users, rather than
a count, for messages with few total reactions. The ideal cutoff may depend on
the space available for displaying reactions; the official web application
displays names when <=3 total reactions are present with this setting enabled.
**Changes**: New in Zulip 5.0 (feature level 125).
schema:
type: boolean
example: false
- name: default_view - name: default_view
in: query in: query
description: | description: |
@ -9884,6 +9898,19 @@ paths:
description: | description: |
Whether to [translate emoticons to emoji](/help/enable-emoticon-translations) Whether to [translate emoticons to emoji](/help/enable-emoticon-translations)
in messages the user sends. in messages the user sends.
display_emoji_reaction_users:
type: boolean
description: |
Whether to display the names of reacting users on a message.
When enabled, clients should display the names of reacting
users, rather than a count, for messages with few total
reactions. The ideal cutoff may depend on the space
available for displaying reactions; the official web
application displays names when <=3 total reactions are
present with this setting enabled.
**Changes**: New in Zulip 5.0 (feature level 125).
default_language: default_language:
type: string type: string
description: | description: |
@ -11648,6 +11675,19 @@ paths:
description: | description: |
Whether to [translate emoticons to emoji](/help/enable-emoticon-translations) Whether to [translate emoticons to emoji](/help/enable-emoticon-translations)
in messages the user sends. in messages the user sends.
display_emoji_reaction_users:
type: boolean
description: |
Whether to display the names of reacting users on a message.
When enabled, clients should display the names of reacting
users, rather than a count, for messages with few total
reactions. The ideal cutoff may depend on the space
available for displaying reactions; the official web
application displays names when <=3 total reactions are
present with this setting enabled.
**Changes**: New in Zulip 5.0 (feature level 125).
default_language: default_language:
type: string type: string
description: | description: |
@ -12591,6 +12631,20 @@ paths:
schema: schema:
type: boolean type: boolean
example: true example: true
- name: display_emoji_reaction_users
in: query
description: |
Whether to display the names of reacting users on a message.
When enabled, clients should display the names of reacting users, rather than
a count, for messages with few total reactions. The ideal cutoff may depend on
the space available for displaying reactions; the official web application
displays names when <=3 total reactions are present with this setting enabled.
**Changes**: New in Zulip 5.0 (feature level 125).
schema:
type: boolean
example: false
- name: default_language - name: default_language
in: query in: query
description: | description: |

View File

@ -341,6 +341,7 @@ def update_realm_user_settings_defaults(
json_validator=check_int_in(UserProfile.COLOR_SCHEME_CHOICES), default=None json_validator=check_int_in(UserProfile.COLOR_SCHEME_CHOICES), default=None
), ),
translate_emoticons: Optional[bool] = REQ(json_validator=check_bool, default=None), translate_emoticons: Optional[bool] = REQ(json_validator=check_bool, default=None),
display_emoji_reaction_users: Optional[bool] = REQ(json_validator=check_bool, default=None),
default_view: Optional[str] = REQ( default_view: Optional[str] = REQ(
str_validator=check_string_in(default_view_options), default=None str_validator=check_string_in(default_view_options), default=None
), ),

View File

@ -146,6 +146,7 @@ def json_change_settings(
json_validator=check_int_in(UserProfile.COLOR_SCHEME_CHOICES), default=None json_validator=check_int_in(UserProfile.COLOR_SCHEME_CHOICES), default=None
), ),
translate_emoticons: Optional[bool] = REQ(json_validator=check_bool, default=None), translate_emoticons: Optional[bool] = REQ(json_validator=check_bool, default=None),
display_emoji_reaction_users: Optional[bool] = REQ(json_validator=check_bool, default=None),
default_language: Optional[str] = REQ(default=None), default_language: Optional[str] = REQ(default=None),
default_view: Optional[str] = REQ( default_view: Optional[str] = REQ(
str_validator=check_string_in(default_view_options), default=None str_validator=check_string_in(default_view_options), default=None