FEATURE: the ability to change the order of flags (#27269)

Continued work on moderate flags UI.
In this PR admins are allowed to change the order of flags. The notify user flag is always on top but all other flags can be moved.
This commit is contained in:
Krzysztof Kotlarek
2024-06-05 13:27:06 +10:00
committed by GitHub
parent c1ecbb8d28
commit aa88b07640
21 changed files with 352 additions and 11 deletions

View File

@ -41,4 +41,14 @@ RSpec.describe FlagGuardian do
expect(Guardian.new(user).can_toggle_flag?).to eq(false)
end
end
describe "#can_reorder_flag?" do
it "returns true for admin and false for regular user and notify_user" do
expect(Guardian.new(admin).can_reorder_flag?(Flag.system.last)).to eq(true)
expect(
Guardian.new(admin).can_reorder_flag?(Flag.system.find_by(name_key: "notify_user")),
).to eq(false)
expect(Guardian.new(user).can_reorder_flag?(Flag.system.last)).to eq(false)
end
end
end