DEV: skip topic deletion staff log when user skip new user tips.

Previously, every time when a user skipped the "new user tips" it will add a staff action log since the discobot's welcome post is destroyed.
This commit is contained in:
Vinoth Kannan
2020-09-23 12:25:39 +05:30
parent 1504fe7231
commit 18f0cef72e
4 changed files with 14 additions and 8 deletions

View File

@ -154,7 +154,6 @@ en:
reset_trigger: "tutorial"
title: "New user tutorial completion certificate"
cert_title: "In recognition of successful completion of the new user tutorial"
delete_reason: "User skipped the new user tips"
hello:
title: "Greetings!"

View File

@ -194,7 +194,7 @@ after_initialize do
return if topic.blank?
first_post = topic.ordered_posts.first
PostDestroyer.new(Discourse.system_user, first_post, context: I18n.t('discourse_narrative_bot.new_user_narrative.delete_reason')).destroy
PostDestroyer.new(Discourse.system_user, first_post, skip_staff_log: true).destroy
DiscourseNarrativeBot::Store.remove(self.id)
end

View File

@ -119,7 +119,10 @@ describe User do
it 'should delete the existing PM' do
user.user_option.skip_new_user_tips = true
expect { user.user_option.save! }.to change { Topic.count }.by(-1)
expect {
user.user_option.save!
}.to change { Topic.count }.by(-1)
.and change { UserHistory.count }.by(0)
end
end