0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/spec/system/page_objects/pages/admin_emojis.rb
Steven Chang bd3906ce64
FEATURE: Add bulk emoji import/export for admins (#41816)
Previously, admins could only add or delete custom emojis one at a time
through the admin UI, with no way to migrate emoji sets between sites or
manage them in bulk.

This adds a Select to export flow on the emoji list page that packages
selected emojis (images + a CSV manifest) into a downloadable ZIP, and
an Import page that accepts a ZIP, previews the result with per-emoji
conflict resolution (keep existing / use incoming), and applies the
import in a single confirmed transaction.

The generated CSV manifest contains a list of the exported emoji names,
groups, and filenames. The import process relies on this manifest, and
only imports emojis listed on it. Should there be conflicting between
identical names, non matching groups, etc. the admin will be able to see
conflicts on a preview confirmation page.

<img width="1462" height="899" alt="image"
src="https://github.com/user-attachments/assets/b6e45b8b-0081-41bb-88c5-a5525287827e"
/>
<img width="1461" height="852" alt="image"
src="https://github.com/user-attachments/assets/feb9a791-eb70-4c1e-b2f7-495884282aa3"
/>
2026-07-20 15:56:49 -07:00

58 lines
1.2 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class AdminEmojis < AdminBase
def visit_page
page.visit "/admin/config/emoji"
self
end
def visit_import_page
page.visit "/admin/config/emoji/import"
self
end
def has_emoji_listed?(name)
page.has_css?(emoji_table_selector, text: name)
end
def has_no_emoji_listed?(name)
page.has_no_css?(emoji_table_selector, text: name)
end
def delete_emoji(name)
find(".d-table__row", text: name).find(delete_button_selector).click
end
def upload_zip(path)
attach_file(path, class: "admin-emoji-import__file-input", make_visible: true)
self
end
def has_import_preview?
page.has_css?(".admin-emoji-import__summary")
end
def confirm_import
find(".admin-emoji-import__actions .btn-primary").click
self
end
def click_tab(tab_name)
find(".admin-emoji-tabs__#{tab_name}").click
self
end
private
def emoji_table_selector
"#custom_emoji"
end
def delete_button_selector
".d-table__cell-action-delete"
end
end
end
end