mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 06:49:30 +08:00
FIX: Return additional message types properly
Following a recent refactor, some methods from `FlagSettings` have been renamed (`custom_types` -> `additional_message_types`). The `PostActionType` model was using `custom_types` but when the renaming was done, it was renamed to `with_additional_message` instead of `additional_message_types`, which under the right circumstances will raise an error.
This commit is contained in:

committed by
Loïc Guitaut

parent
584106b752
commit
97cd03d41a
@ -28,4 +28,30 @@ RSpec.describe PostActionType do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ".additional_message_types" do
|
||||
before { described_class.stubs(:overridden_by_plugin_or_skipped_db?).returns(overriden) }
|
||||
|
||||
context "when overridden by plugin or skipped DB" do
|
||||
let(:overriden) { true }
|
||||
|
||||
it "returns additional types from flag settings" do
|
||||
expect(described_class.additional_message_types).to eq(
|
||||
described_class.flag_settings.additional_message_types,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context "when not overriden by plugin or skipped DB" do
|
||||
let(:overriden) { false }
|
||||
|
||||
it "returns all flags" do
|
||||
expect(described_class.additional_message_types).to eq(
|
||||
illegal: 10,
|
||||
notify_moderators: 7,
|
||||
notify_user: 6,
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user