Skip to content
Snippets Groups Projects
Commit 31360b70 authored by Hadrien Froger's avatar Hadrien Froger
Browse files

Merge branch 'fix/migration' into 'master'

Fix migration: if no cop existing, don't update 20230921093701_copbot_email.decidim_spam_signal.rb

See merge request !26
parents 7f69d36b 0ee407a5
Branches
Tags v5.0.9
1 merge request!26Fix migration: if no cop existing, don't update 20230921093701_copbot_email.decidim_spam_signal.rb
......@@ -5,9 +5,11 @@ class CopbotEmail < ActiveRecord::Migration[5.2]
def change
# bot email should never be bot@decidim.org
cop = Decidim::User.where(nickname: "bot").first
if cop
cop.email = ENV.fetch("USER_BOT_EMAIL", "bot@example.org")
cop.skip_confirmation!
cop.save
end
Decidim::User.where(email: "bot@decidim.org").each do |legacy_bot|
Decidim::UserReport.where(user: legacy_bot).update(user: cop)
legacy_bot.destroy
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment