diff --git a/static/js/realm_user_settings_defaults.ts b/static/js/realm_user_settings_defaults.ts index cd2a1104fd..dbaeab0753 100644 --- a/static/js/realm_user_settings_defaults.ts +++ b/static/js/realm_user_settings_defaults.ts @@ -32,6 +32,7 @@ export type RealmDefaultSettingsType = { realm_name_in_notifications: boolean; starred_message_counts: boolean; translate_emoticons: boolean; + display_emoji_reaction_users: boolean; twenty_four_hour_time: boolean; wildcard_mentions_notify: boolean; }; diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index 5f4a0a9d87..bbb316fca4 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -606,6 +606,7 @@ export function dispatch_normal_event(event) { "timezone", "twenty_four_hour_time", "translate_emoticons", + "display_emoji_reaction_users", "starred_message_counts", "send_stream_typing_notifications", "send_private_typing_notifications", @@ -686,6 +687,10 @@ export function dispatch_normal_event(event) { // Rerender buddy list status emoji 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") { $("#go-to-default-view-hotkey-help").toggleClass("notdisplayed", !event.value); } diff --git a/static/js/settings_config.ts b/static/js/settings_config.ts index 5406695afc..98a2031c44 100644 --- a/static/js/settings_config.ts +++ b/static/js/settings_config.ts @@ -496,6 +496,12 @@ export const display_settings_labels = { defaultMessage: "Convert emoticons before sending (:) 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"}), }; diff --git a/static/js/user_settings.ts b/static/js/user_settings.ts index bb6bbff0fc..31228c2dd5 100644 --- a/static/js/user_settings.ts +++ b/static/js/user_settings.ts @@ -32,6 +32,7 @@ export type UserSettingsType = { realm_name_in_notifications: boolean; starred_message_counts: boolean; translate_emoticons: boolean; + display_emoji_reaction_users: boolean; twenty_four_hour_time: boolean; wildcard_mentions_notify: boolean; send_stream_typing_notifications: boolean; diff --git a/static/templates/settings/display_settings.hbs b/static/templates/settings/display_settings.hbs index be80c97627..13fcccbbb0 100644 --- a/static/templates/settings/display_settings.hbs +++ b/static/templates/settings/display_settings.hbs @@ -73,6 +73,13 @@ label=settings_label.translate_emoticons 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}}
diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md index 2356c41e1f..d68b58d138 100644 --- a/templates/zerver/api/changelog.md +++ b/templates/zerver/api/changelog.md @@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with. ## 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 releases. diff --git a/version.py b/version.py index 8d035cd474..6eabf0aa7f 100644 --- a/version.py +++ b/version.py @@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3" # Changes should be accompanied by documentation explaining what the # new level means in templates/zerver/api/changelog.md, as well as # "**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 # only when going from an old version of the code to a newer version. Bump diff --git a/zerver/migrations/0389_userprofile_display_emoji_reaction_users.py b/zerver/migrations/0389_userprofile_display_emoji_reaction_users.py new file mode 100644 index 0000000000..adb36da249 --- /dev/null +++ b/zerver/migrations/0389_userprofile_display_emoji_reaction_users.py @@ -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), + ), + ] diff --git a/zerver/models.py b/zerver/models.py index add7e67f6a..3d08ad3c78 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -1467,6 +1467,7 @@ class UserBaseSettings(models.Model): fluid_layout_width: bool = models.BooleanField(default=False) high_contrast_mode: 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) starred_message_counts: bool = models.BooleanField(default=True) COLOR_SCHEME_AUTOMATIC = 1 @@ -1603,6 +1604,7 @@ class UserBaseSettings(models.Model): **notification_setting_types, **dict( # Add new general settings here. + display_emoji_reaction_users=bool, escape_navigates_to_default_view=bool, send_private_typing_notifications=bool, send_read_receipts=bool, diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 9c0674792c..38b45dc831 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -7962,6 +7962,20 @@ paths: schema: type: boolean 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 in: query description: | @@ -9884,6 +9898,19 @@ paths: description: | Whether to [translate emoticons to emoji](/help/enable-emoticon-translations) 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: type: string description: | @@ -11648,6 +11675,19 @@ paths: description: | Whether to [translate emoticons to emoji](/help/enable-emoticon-translations) 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: type: string description: | @@ -12591,6 +12631,20 @@ paths: schema: type: boolean 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 in: query description: | diff --git a/zerver/views/realm.py b/zerver/views/realm.py index c83fd6c8f5..6887e76edb 100644 --- a/zerver/views/realm.py +++ b/zerver/views/realm.py @@ -341,6 +341,7 @@ def update_realm_user_settings_defaults( json_validator=check_int_in(UserProfile.COLOR_SCHEME_CHOICES), 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( str_validator=check_string_in(default_view_options), default=None ), diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.py index 0b92dca7e3..3de690b335 100644 --- a/zerver/views/user_settings.py +++ b/zerver/views/user_settings.py @@ -146,6 +146,7 @@ def json_change_settings( json_validator=check_int_in(UserProfile.COLOR_SCHEME_CHOICES), 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_view: Optional[str] = REQ( str_validator=check_string_in(default_view_options), default=None