FIX: Allow advanced tutorial when title emojis are disabled

We already skip validations for other uses of PostCreator in the narrative bot, so this commit adds it in the `reply_to` action as well
This commit is contained in:
David Taylor 2019-11-20 15:29:06 +00:00
parent 555711ccb5
commit bbb814e58e
2 changed files with 11 additions and 1 deletions

View File

@ -18,7 +18,8 @@ module DiscourseNarrativeBot
raw: raw,
topic_id: post.topic_id,
reply_to_post_number: post.post_number,
post_alert_options: defaut_post_alert_opts
post_alert_options: defaut_post_alert_opts,
skip_validations: true
}
new_post = PostCreator.create!(self.discobot_user, default_opts.merge(opts))

View File

@ -125,6 +125,15 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(new_post.raw).to eq(expected_raw.chomp)
expect(new_post.topic.id).to_not eq(topic.id)
end
it 'should not explode if title emojis are disabled' do
SiteSetting.max_emojis_in_title = 0
narrative.reset_bot(user, other_post)
expect(Topic.last.title).to eq(I18n.t('discourse_narrative_bot.advanced_user_narrative.title'))
expect(new_post.topic.id).to_not eq(topic.id)
end
end
end