A platform for community discussion. Free, open, simple.
FEATURE: Promote discourse_reactions_allow_any_emoji out of experimental (#35589)
Martin Brennan2075f61abb05
diff --git a/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb b/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rbindex 289069adfaf..3ccbb62bf3e 100644--- a/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb+++ b/plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb@@ -12,7 +12,7 @@ class DiscourseReactions::CustomReactionsController < ApplicationControllerreaction = params[:reaction]invalid_reaction =- if SiteSetting.discourse_reactions_experimental_allow_any_emoji+ if SiteSetting.discourse_reactions_allow_any_emoji!Emoji.exists?(reaction)elseDiscourseReactions::Reaction.valid_reactions.exclude?(params[:reaction])diff --git a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjs b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjsindex 58c55c1c501..26702774aff 100644--- a/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjs+++ b/plugins/discourse-reactions/assets/javascripts/discourse/components/discourse-reactions-picker.gjs@@ -89,7 +89,7 @@ export default class DiscourseReactionsPicker extends Component {get optimalColsCount() {let count = this.reactionInfo.length;- if (this.siteSettings.discourse_reactions_experimental_allow_any_emoji) {+ if (this.siteSettings.discourse_reactions_allow_any_emoji) {count += 1;}@@ -181,9 +181,7 @@ export default class DiscourseReactionsPicker extends Component {{{emoji reaction.id}}</DButton>{{/each}}- {{#if- this.siteSettings.discourse_reactions_experimental_allow_any_emoji- }}+ {{#if this.siteSettings.discourse_reactions_allow_any_emoji}}<EmojiPicker...attributes@icon="far-face-smile"diff --git a/plugins/discourse-reactions/config/locales/server.en.yml b/plugins/discourse-reactions/config/locales/server.en.ymlindex dc583c3e01d..6756a441350 100644--- a/plugins/discourse-reactions/config/locales/server.en.yml+++ b/plugins/discourse-reactions/config/locales/server.en.yml@@ -7,7 +7,7 @@ en:discourse_reactions_desaturated_reaction_panel: "Reduces visual noise of reactions by displaying them desaturated until hover."discourse_reactions_excluded_from_like: "Reactions that do not count as a Like. Any reactions that are not on this list will count as a Like for badges, reporting, and other purposes."discourse_reactions_like_sync_enabled: "If this is enabled, historical reactions will have their matching Like records created, except those reactions defined in `discourse_reactions_excluded_from_like`. This sync will happen on a regular basis in the background, and also when you change `discourse_reactions_excluded_from_like`."- discourse_reactions_experimental_allow_any_emoji: "EXPERIMENTAL: If this is enabled, will add a button allowing users to select any emoji in the reactions picker. Members will be allowed to choose any emoji, including custom emoji, for reactions, so enable this with caution."+ discourse_reactions_allow_any_emoji: "If this is enabled, will add a button allowing users to select any emoji in the reactions picker. Members will be allowed to choose any emoji, including custom emoji, for reactions. To limit available reactions, use the `emoji_deny_list` site setting."errors:invalid_excluded_emoji: "You cannot exclude emojis that are not in 'discourse reactions enabled reactions' and you cannot exclude the emoji used for 'discourse reactions reaction for like'."badges:diff --git a/plugins/discourse-reactions/config/settings.yml b/plugins/discourse-reactions/config/settings.ymlindex dd19721cc00..4361d3732a1 100644--- a/plugins/discourse-reactions/config/settings.yml+++ b/plugins/discourse-reactions/config/settings.yml@@ -14,6 +14,7 @@ discourse_reactions:type: emoji_listdefault: "+1|laughing|open_mouth|clap|confetti_ball|hugs"client: true+ area: "emojis"discourse_reactions_desaturated_reaction_panel:default: falseclient: true@@ -21,9 +22,10 @@ discourse_reactions:type: emoji_listdefault: "-1"validator: "ReactionsExcludedFromLikeSiteSettingValidator"+ area: "emojis"discourse_reactions_like_sync_enabled:default: true- discourse_reactions_experimental_allow_any_emoji:+ discourse_reactions_allow_any_emoji:default: falseclient: true- area: "experimental"+ area: "emojis"diff --git a/plugins/discourse-reactions/db/migrate/20251024020353_rename_discourse_reactions_experimental_allow_any_emoji.rb b/plugins/discourse-reactions/db/migrate/20251024020353_rename_discourse_reactions_experimental_allow_any_emoji.rbnew file mode 100644index 00000000000..3c1d051dd4b--- /dev/null+++ b/plugins/discourse-reactions/db/migrate/20251024020353_rename_discourse_reactions_experimental_allow_any_emoji.rb@@ -0,0 +1,13 @@+# frozen_string_literal: true+class RenameDiscourseReactionsExperimentalAllowAnyEmoji < ActiveRecord::Migration[8.0]+ def up+ DB.exec <<~SQL+ UPDATE site_settings SET name = 'discourse_reactions_allow_any_emoji'+ WHERE name = 'discourse_reactions_experimental_allow_any_emoji'+ SQL+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/plugins/discourse-reactions/plugin.rb b/plugins/discourse-reactions/plugin.rbindex e3a7a581746..bb66aa4a0dc 100644--- a/plugins/discourse-reactions/plugin.rb+++ b/plugins/discourse-reactions/plugin.rb@@ -174,7 +174,7 @@ after_initialize doobject.emoji_reactions.any? do |reaction|reaction.reaction_users.any? { |ru| ru.user_id == scope.user.id } &&(- if SiteSetting.discourse_reactions_experimental_allow_any_emoji+ if SiteSetting.discourse_reactions_allow_any_emojireaction.reaction_value != DiscourseReactions::Reaction.main_reaction_idelseDiscourseReactions::Reaction.reactions_counting_as_like.include?(diff --git a/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rb b/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rbindex c5558f9c528..4424495f58e 100644--- a/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rb+++ b/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rb@@ -8,11 +8,11 @@ describe DiscourseReactions::CustomReactionsController dobefore doSiteSetting.discourse_reactions_enabled = true- SiteSetting.discourse_reactions_experimental_allow_any_emoji = true+ SiteSetting.discourse_reactions_allow_any_emoji = trueSiteSetting.discourse_reactions_enabled_reactions = "heart|thumbsup|laughing"end- describe "custom emoji reactions with discourse_reactions_experimental_allow_any_emoji enabled" do+ describe "custom emoji reactions with discourse_reactions_allow_any_emoji enabled" docontext "when user is logged in" dobefore { sign_in(user) }@@ -83,9 +83,9 @@ describe DiscourseReactions::CustomReactionsController doendend- describe "custom emoji reactions with discourse_reactions_experimental_allow_any_emoji disabled" do+ describe "custom emoji reactions with discourse_reactions_allow_any_emoji disabled" dobefore do- SiteSetting.discourse_reactions_experimental_allow_any_emoji = false+ SiteSetting.discourse_reactions_allow_any_emoji = falsesign_in(user)enddiff --git a/plugins/discourse-reactions/spec/system/reactions_post_spec.rb b/plugins/discourse-reactions/spec/system/reactions_post_spec.rbindex 743e265bc80..bc5cf98f405 100644--- a/plugins/discourse-reactions/spec/system/reactions_post_spec.rb+++ b/plugins/discourse-reactions/spec/system/reactions_post_spec.rb@@ -44,8 +44,8 @@ describe "Reactions | Post reactions" doexpect(reactions_button).to have_emoji("hugs")end- context "when discourse_reactions_experimental_allow_any_emoji is enabled" do- before { SiteSetting.discourse_reactions_experimental_allow_any_emoji = true }+ context "when discourse_reactions_allow_any_emoji is enabled" do+ before { SiteSetting.discourse_reactions_allow_any_emoji = true }it "allows selecting any emoji for a post reaction" dovisit post_2.urldiff --git a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.js b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.jsindex d7c6e257286..9eef981063a 100644--- a/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.js+++ b/plugins/discourse-reactions/test/javascripts/acceptance/discourse-reactions-custom-emoji-test.js@@ -14,7 +14,7 @@ import ReactionsTopics from "../fixtures/reactions-topic-fixtures";discourse_reactions_enabled_reactions: "otter|open_mouth|heart",discourse_reactions_reaction_for_like: "heart",discourse_reactions_like_icon: "heart",- discourse_reactions_experimental_allow_any_emoji: true,+ discourse_reactions_allow_any_emoji: true,glimmer_post_stream_mode: postStreamMode,});@@ -35,7 +35,7 @@ import ReactionsTopics from "../fixtures/reactions-topic-fixtures";);});- test("Shows EmojiPicker button when discourse_reactions_experimental_allow_any_emoji is enabled", async function (assert) {+ test("Shows EmojiPicker button when discourse_reactions_allow_any_emoji is enabled", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");await triggerEvent("#post_2 button.btn-toggle-reaction-like",@@ -77,7 +77,7 @@ import ReactionsTopics from "../fixtures/reactions-topic-fixtures";);});- test("Selected custom emoji is added to reactions when discourse_reactions_experimental_allow_any_emoji is enabled", async function (assert) {+ test("Selected custom emoji is added to reactions when discourse_reactions_allow_any_emoji is enabled", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");await triggerEvent("#post_2 button.btn-toggle-reaction-like",@@ -109,7 +109,7 @@ import ReactionsTopics from "../fixtures/reactions-topic-fixtures";discourse_reactions_enabled_reactions: "otter|open_mouth|heart",discourse_reactions_reaction_for_like: "heart",discourse_reactions_like_icon: "heart",- discourse_reactions_experimental_allow_any_emoji: false,+ discourse_reactions_allow_any_emoji: false,glimmer_post_stream_mode: postStreamMode,});@@ -125,7 +125,7 @@ import ReactionsTopics from "../fixtures/reactions-topic-fixtures";);});- test("Does not show EmojiPicker button when discourse_reactions_experimental_allow_any_emoji is disabled", async function (assert) {+ test("Does not show EmojiPicker button when discourse_reactions_allow_any_emoji is disabled", async function (assert) {await visit("/t/topic_with_reactions_and_likes/374");await triggerEvent("#post_2 button.btn-toggle-reaction-like",