mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 17:15:47 +08:00
d57b7abe67
After data seed, we should reset Redis cache to ensure that the correct flags are cached.
However, `db:create` is skipping Redis
https://github.com/discourse/discourse/blob/main/lib/tasks/db.rake#L39
And uses `ActiveSupport::Cache::MemoryStore.new`
e2292d4c59/lib/discourse.rb (L523)
Therefore, the reset flags cache was moved to initializers and evaluated only when the cache is Redis and Flags table already exists.
Meta: https://meta.discourse.org/t/development-install-fails-when-running-bin-rails-db-migrate/332754
77 lines
1.7 KiB
Ruby
77 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
Flag.seed do |s|
|
|
s.id = 6
|
|
s.name = "notify_user"
|
|
s.notify_type = false
|
|
s.auto_action_type = false
|
|
s.require_message = true
|
|
s.applies_to = %w[Post Chat::Message]
|
|
s.skip_reset_flag_callback = true
|
|
end
|
|
Flag.seed do |s|
|
|
s.id = 3
|
|
s.name = "off_topic"
|
|
s.notify_type = true
|
|
s.auto_action_type = true
|
|
s.require_message = false
|
|
s.applies_to = %w[Post Chat::Message]
|
|
s.skip_reset_flag_callback = true
|
|
end
|
|
Flag.seed do |s|
|
|
s.id = 4
|
|
s.name = "inappropriate"
|
|
s.notify_type = true
|
|
s.auto_action_type = true
|
|
s.require_message = false
|
|
s.applies_to = %w[Post Topic Chat::Message]
|
|
s.skip_reset_flag_callback = true
|
|
end
|
|
Flag.seed do |s|
|
|
s.id = 8
|
|
s.name = "spam"
|
|
s.notify_type = true
|
|
s.auto_action_type = true
|
|
s.require_message = false
|
|
s.applies_to = %w[Post Topic Chat::Message]
|
|
s.skip_reset_flag_callback = true
|
|
end
|
|
Flag.seed do |s|
|
|
s.id = 10
|
|
s.name = "illegal"
|
|
s.notify_type = true
|
|
s.auto_action_type = false
|
|
s.require_message = true
|
|
s.applies_to = %w[Post Topic Chat::Message]
|
|
s.skip_reset_flag_callback = true
|
|
end
|
|
Flag.seed do |s|
|
|
s.id = 7
|
|
s.name = "notify_moderators"
|
|
s.notify_type = true
|
|
s.auto_action_type = false
|
|
s.require_message = true
|
|
s.applies_to = %w[Post Topic Chat::Message]
|
|
s.skip_reset_flag_callback = true
|
|
end
|
|
Flag.unscoped.seed do |s|
|
|
s.id = 9
|
|
s.name = "needs_approval"
|
|
s.notify_type = false
|
|
s.auto_action_type = false
|
|
s.require_message = false
|
|
s.score_type = true
|
|
s.applies_to = %w[]
|
|
s.skip_reset_flag_callback = true
|
|
end
|
|
Flag.unscoped.seed do |s|
|
|
s.id = 2
|
|
s.name = "like"
|
|
s.notify_type = false
|
|
s.auto_action_type = false
|
|
s.require_message = false
|
|
s.score_type = false
|
|
s.applies_to = %w[Post]
|
|
s.skip_reset_flag_callback = true
|
|
end
|