FEATURE: Add an emoji deny list site setting (#20929)

This feature will allow sites to define which emoji are not allowed. Emoji in this list should be excluded from the set we show in the core emoji picker used in the composer for posts when emoji are enabled. And they should not be allowed to be chosen to be added to messages or as reactions in chat.

This feature prevents denied emoji from appearing in the following scenarios:
- topic title and page title
- private messages (topic title and body)
- inserting emojis into a chat
- reacting to chat messages
- using the emoji picker (composer, user status etc)
- using search within emoji picker

It also takes into account the various ways that emojis can be accessed, such as:
- emoji autocomplete suggestions
- emoji favourites (auto populates when adding to emoji deny list for example)
- emoji inline translations
- emoji skintones (ie. for certain hand gestures)
This commit is contained in:
David Battersby
2023-04-13 15:38:54 +08:00
committed by GitHub
parent 5b1306cb54
commit 967010e545
24 changed files with 316 additions and 15 deletions

View File

@ -4,6 +4,7 @@ module PageObjects
module Components
class Composer < PageObjects::Components::Base
COMPOSER_ID = "#reply-control"
AUTOCOMPLETE_MENU = ".autocomplete.ac-emoji"
def opened?
page.has_css?("#{COMPOSER_ID}.open")
@ -14,6 +15,11 @@ module PageObjects
self
end
def click_toolbar_button(number)
find(".d-editor-button-bar button:nth-child(#{number})").click
self
end
def fill_title(title)
find("#{COMPOSER_ID} #reply-title").fill_in(with: title)
self
@ -54,6 +60,26 @@ module PageObjects
find("#{COMPOSER_ID} .btn-primary .d-button-label")
end
def emoji_picker
find("#{COMPOSER_ID} .emoji-picker")
end
def emoji_autocomplete
find(AUTOCOMPLETE_MENU)
end
def has_emoji_autocomplete?
has_css?(AUTOCOMPLETE_MENU)
end
def has_emoji_suggestion?(emoji)
has_css?("#{AUTOCOMPLETE_MENU} .emoji-shortname", text: emoji)
end
def has_emoji_preview?(emoji)
page.has_css?(".d-editor-preview .emoji[title=':#{emoji}:']")
end
def composer_input
find("#{COMPOSER_ID} .d-editor .d-editor-input")
end