mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:37:19 +08:00
FIX: stop memoize PostActionTypes (#28005)
Memoizing all_flags on PostActionType was a mistake. This commit brings back the cache on the serialize level.
This commit is contained in:

committed by
GitHub

parent
5105fce899
commit
fb7cc2d375
@ -1,6 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe PostActionType do
|
||||
describe "Callbacks" do
|
||||
describe "#expiry_cache" do
|
||||
it "should clear the cache on save" do
|
||||
cache = ApplicationSerializer.fragment_cache
|
||||
|
||||
cache["post_action_types_#{I18n.locale}"] = "test"
|
||||
cache["post_action_flag_types_#{I18n.locale}"] = "test2"
|
||||
|
||||
PostActionType.new(name_key: "some_key").save!
|
||||
|
||||
expect(cache["post_action_types_#{I18n.locale}"]).to eq(nil)
|
||||
expect(cache["post_action_flag_types_#{I18n.locale}"]).to eq(nil)
|
||||
ensure
|
||||
ApplicationSerializer.fragment_cache.clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#types" do
|
||||
context "when verifying enum sequence" do
|
||||
before { @types = PostActionType.types }
|
||||
|
Reference in New Issue
Block a user