FIX: move something else flag to the bottom (#27366)

The mistake was made when flags were moved to the database. The `notify_moderators` (something else) flag should be the last position on the list.

This commit contains 3 changes:
- update fixtures order;
- remove position and enable from fixtures (they can be overridden by admin and we don't want seed to restore them);
- migration to fix data if the order was not changed by admin.
This commit is contained in:
Krzysztof Kotlarek
2024-06-06 15:45:30 +10:00
committed by GitHub
parent 4a1048f541
commit 4b1e017722
5 changed files with 54 additions and 36 deletions

View File

@ -14,7 +14,7 @@ describe "Admin Flags Page", type: :system do
topic_page.visit_topic(post.topic)
topic_page.open_flag_topic_modal
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
["Something Else", "It's Inappropriate", "It's Spam", "It's Illegal"],
["It's Inappropriate", "It's Spam", "It's Illegal", "Something Else"],
)
visit "/admin/config/flags"
@ -23,7 +23,7 @@ describe "Admin Flags Page", type: :system do
topic_page.visit_topic(post.topic)
topic_page.open_flag_topic_modal
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
["Something Else", "It's Inappropriate", "It's Illegal"],
["It's Inappropriate", "It's Illegal", "Something Else"],
)
Flag.system.where(name: "spam").update!(enabled: true)
@ -33,7 +33,7 @@ describe "Admin Flags Page", type: :system do
topic_page.visit_topic(post.topic)
topic_page.open_flag_topic_modal
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
["Something Else", "It's Inappropriate", "It's Spam", "It's Illegal"],
["It's Inappropriate", "It's Spam", "It's Illegal", "Something Else"],
)
visit "/admin/config/flags"
@ -42,7 +42,7 @@ describe "Admin Flags Page", type: :system do
topic_page.visit_topic(post.topic)
topic_page.open_flag_topic_modal
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
["Something Else", "It's Inappropriate", "It's Illegal", "It's Spam"],
["It's Inappropriate", "It's Illegal", "It's Spam", "Something Else"],
)
visit "/admin/config/flags"
@ -51,7 +51,7 @@ describe "Admin Flags Page", type: :system do
topic_page.visit_topic(post.topic)
topic_page.open_flag_topic_modal
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
["Something Else", "It's Inappropriate", "It's Spam", "It's Illegal"],
["It's Inappropriate", "It's Spam", "It's Illegal", "Something Else"],
)
end
@ -62,13 +62,13 @@ describe "Admin Flags Page", type: :system do
it "does not allow bottom flag to move down" do
visit "/admin/config/flags"
admin_flags_page.open_flag_menu("illegal")
admin_flags_page.open_flag_menu("notify_moderators")
expect(page).not_to have_css(".dropdown-menu__item .move-down")
end
it "does not allow top flag to move up" do
visit "/admin/config/flags"
admin_flags_page.open_flag_menu("notify_moderators")
admin_flags_page.open_flag_menu("off_topic")
expect(page).not_to have_css(".dropdown-menu__item .move-up")
end
end