0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-05 21:57:36 +08:00
discourse/spec/system/admin_customize_emojis_import_spec.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

41 lines
1.1 KiB
Ruby
Vendored

# frozen_string_literal: true
describe "Admin Emoji Bulk Import" do
fab!(:current_user, :admin)
let(:emojis_page) { PageObjects::Pages::AdminEmojis.new }
let(:dialog) { PageObjects::Components::Dialog.new }
let(:sample_zip) { Rails.public_path.join("emoji-import-sample.zip") }
before { sign_in(current_user) }
it "imports emojis from the sample ZIP and shows them in the list" do
emojis_page.visit_import_page
emojis_page.upload_zip(sample_zip)
expect(emojis_page).to have_import_preview
emojis_page.confirm_import
expect(page).to have_current_path("/admin/config/emoji")
expect(emojis_page).to have_emoji_listed("discourse")
end
it "can re-import without error when emoji already exists (conflict resolution)" do
emojis_page.visit_import_page
emojis_page.upload_zip(sample_zip)
emojis_page.confirm_import
emojis_page.visit_import_page
emojis_page.upload_zip(sample_zip)
expect(emojis_page).to have_import_preview
emojis_page.confirm_import
expect(page).to have_current_path("/admin/config/emoji")
expect(emojis_page).to have_emoji_listed("discourse")
end
end