From 44aaf4415def9be6961736b648315830fa971e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 7 Jul 2020 18:24:31 +0200 Subject: [PATCH] DEV: ensure discobot has a user_option & user_profile When doing a migration, there might be some cases where the discobot user doesn't have a user_option / user_profile record(s). This ensures we always create one during the seed phase. --- plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb b/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb index fda50b48299..527dfbe3c90 100644 --- a/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb +++ b/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb @@ -38,11 +38,15 @@ end bot.update!(admin: true, moderator: false) +bot.create_user_option! if !bot.user_option + bot.user_option.update!( email_messages_level: UserOption.email_level_types[:never], email_level: UserOption.email_level_types[:never] ) +bot.create_user_profile! if !bot.user_profile + if !bot.user_profile.bio_raw bot.user_profile.update!( bio_raw: I18n.t('discourse_narrative_bot.bio', site_title: SiteSetting.title, discobot_username: bot.username)