mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 08:13:51 +08:00
69205cb1e5
This configuration makes it so that a missing translation will raise an error during test execution. Better discover there than after deploy.
25 lines
876 B
Ruby
25 lines
876 B
Ruby
# frozen_string_literal: true
|
|
|
|
class MigrateOldModeratorPosts < ActiveRecord::Migration[4.2]
|
|
def migrate_key(action_code)
|
|
I18n.overrides_disabled do
|
|
text = I18n.t("topic_statuses.#{action_code.gsub(".", "_")}")
|
|
|
|
execute "UPDATE posts SET action_code = '#{action_code}', raw = '', cooked = '', post_type = 3 where post_type = 2 AND raw = #{ActiveRecord::Base.connection.quote(text)}"
|
|
end
|
|
end
|
|
|
|
def up
|
|
Rails.application.config.i18n.raise_on_missing_translations = false
|
|
migrate_key("closed.enabled")
|
|
migrate_key("closed.disabled")
|
|
migrate_key("archived.enabled")
|
|
migrate_key("archived.disabled")
|
|
migrate_key("pinned.enabled")
|
|
migrate_key("pinned.disabled")
|
|
migrate_key("pinned_globally.enabled")
|
|
migrate_key("pinned_globally.disabled")
|
|
Rails.application.config.i18n.raise_on_missing_translations = true
|
|
end
|
|
end
|