mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 23:13:50 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
20 lines
855 B
Ruby
20 lines
855 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ReplaceBlockedSilenceTranslation < ActiveRecord::Migration[5.1]
|
|
def change
|
|
execute <<~SQL
|
|
UPDATE translation_overrides
|
|
SET translation_key = 'system_messages.silenced_by_staff.subject_template'
|
|
WHERE translation_key = 'system_messages.blocked_by_staff.subject_template'
|
|
AND NOT EXISTS (SELECT 1 FROM translation_overrides WHERE translation_key = 'system_messages.silenced_by_staff.subject_template');
|
|
SQL
|
|
|
|
execute <<~SQL
|
|
UPDATE translation_overrides
|
|
SET translation_key = 'system_messages.silenced_by_staff.text_body_template'
|
|
WHERE translation_key = 'system_messages.blocked_by_staff.text_body_template'
|
|
AND NOT EXISTS (SELECT 1 FROM translation_overrides WHERE translation_key = 'system_messages.silenced_by_staff.text_body_template');
|
|
SQL
|
|
end
|
|
end
|