A platform for community discussion. Free, open, simple.
FIX: Unexpected return during system_message_sent event
Penar Musarajcfb3f4db1352
diff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rbindex e9ceeee41e8..826d190f032 100644--- a/plugins/discourse-narrative-bot/plugin.rb+++ b/plugins/discourse-narrative-bot/plugin.rb@@ -287,20 +287,20 @@ after_initialize do)self.on(:system_message_sent) do |args|- return if args[:message_type] != 'tl2_promotion_message'- return if !SiteSetting.discourse_narrative_bot_enabled-- raw = I18n.t("discourse_narrative_bot.tl2_promotion_message.text_body_template",- discobot_username: ::DiscourseNarrativeBot::Base.new.discobot_username,- reset_trigger: "#{::DiscourseNarrativeBot::TrackSelector.reset_trigger} #{::DiscourseNarrativeBot::AdvancedUserNarrative.reset_trigger}")-- PostCreator.create!(- ::DiscourseNarrativeBot::Base.new.discobot_user,- title: I18n.t("discourse_narrative_bot.tl2_promotion_message.subject_template"),- raw: raw,- topic_id: args[:post].topic_id,- skip_validations: true- )+ if args[:message_type] == 'tl2_promotion_message' && SiteSetting.discourse_narrative_bot_enabled++ raw = I18n.t("discourse_narrative_bot.tl2_promotion_message.text_body_template",+ discobot_username: ::DiscourseNarrativeBot::Base.new.discobot_username,+ reset_trigger: "#{::DiscourseNarrativeBot::TrackSelector.reset_trigger} #{::DiscourseNarrativeBot::AdvancedUserNarrative.reset_trigger}")++ PostCreator.create!(+ ::DiscourseNarrativeBot::Base.new.discobot_user,+ title: I18n.t("discourse_narrative_bot.tl2_promotion_message.subject_template"),+ raw: raw,+ topic_id: args[:post].topic_id,+ skip_validations: true+ )+ endendPostGuardian.class_eval do