mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 02:43:08 -05:00
FEATURE: Promote discourse_reactions_allow_any_emoji out of experimental (#35589)
Followup f002aa4022
We are renaming `discourse_reactions_experimental_allow_any_emoji` to
`discourse_reactions_allow_any_emoji`
and moving it out of the Experimental site setting area.
We originally kept this setting experimental because we thought
there might besome moderation concerts around allowing any emoji to be
used.
However, we later realised the `emoji_deny_list` core site setting can
be used to effectively restrict which emoji are allowed to be used here.
The setting `discourse_reactions_allow_any_emoji` remains off by
default.
I also added some of the discourse-reactions settings to the `emojis`
site setting area to make them easier to find.
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ class DiscourseReactions::CustomReactionsController < ApplicationController
|
||||
reaction = params[:reaction]
|
||||
|
||||
invalid_reaction =
|
||||
if SiteSetting.discourse_reactions_experimental_allow_any_emoji
|
||||
if SiteSetting.discourse_reactions_allow_any_emoji
|
||||
!Emoji.exists?(reaction)
|
||||
else
|
||||
DiscourseReactions::Reaction.valid_reactions.exclude?(params[:reaction])
|
||||
|
||||
+2
-4
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -14,6 +14,7 @@ discourse_reactions:
|
||||
type: emoji_list
|
||||
default: "+1|laughing|open_mouth|clap|confetti_ball|hugs"
|
||||
client: true
|
||||
area: "emojis"
|
||||
discourse_reactions_desaturated_reaction_panel:
|
||||
default: false
|
||||
client: true
|
||||
@@ -21,9 +22,10 @@ discourse_reactions:
|
||||
type: emoji_list
|
||||
default: "-1"
|
||||
validator: "ReactionsExcludedFromLikeSiteSettingValidator"
|
||||
area: "emojis"
|
||||
discourse_reactions_like_sync_enabled:
|
||||
default: true
|
||||
discourse_reactions_experimental_allow_any_emoji:
|
||||
discourse_reactions_allow_any_emoji:
|
||||
default: false
|
||||
client: true
|
||||
area: "experimental"
|
||||
area: "emojis"
|
||||
|
||||
+13
@@ -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
|
||||
end
|
||||
@@ -174,7 +174,7 @@ after_initialize do
|
||||
object.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_emoji
|
||||
reaction.reaction_value != DiscourseReactions::Reaction.main_reaction_id
|
||||
else
|
||||
DiscourseReactions::Reaction.reactions_counting_as_like.include?(
|
||||
|
||||
+4
-4
@@ -8,11 +8,11 @@ describe DiscourseReactions::CustomReactionsController do
|
||||
|
||||
before do
|
||||
SiteSetting.discourse_reactions_enabled = true
|
||||
SiteSetting.discourse_reactions_experimental_allow_any_emoji = true
|
||||
SiteSetting.discourse_reactions_allow_any_emoji = true
|
||||
SiteSetting.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" do
|
||||
context "when user is logged in" do
|
||||
before { sign_in(user) }
|
||||
|
||||
@@ -83,9 +83,9 @@ describe DiscourseReactions::CustomReactionsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe "custom emoji reactions with discourse_reactions_experimental_allow_any_emoji disabled" do
|
||||
describe "custom emoji reactions with discourse_reactions_allow_any_emoji disabled" do
|
||||
before do
|
||||
SiteSetting.discourse_reactions_experimental_allow_any_emoji = false
|
||||
SiteSetting.discourse_reactions_allow_any_emoji = false
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ describe "Reactions | Post reactions" do
|
||||
expect(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" do
|
||||
visit post_2.url
|
||||
|
||||
+5
-5
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user