mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FEATURE: New 'Reviewable' model to make reviewable items generic
Includes support for flags, reviewable users and queued posts, with REST API backwards compatibility. Co-Authored-By: romanrizzi <romanalejandro@gmail.com> Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
This commit is contained in:
@ -149,13 +149,7 @@ module DiscourseNarrativeBot
|
||||
if SiteSetting.delete_removed_posts_after < 1
|
||||
opts[:delete_removed_posts_after] = 1
|
||||
|
||||
# Flag it and defer so the stub doesn't get destroyed
|
||||
flag = PostAction.create!(
|
||||
user: self.discobot_user,
|
||||
post: post, post_action_type_id:
|
||||
PostActionType.types[:notify_moderators]
|
||||
)
|
||||
|
||||
flag = PostActionCreator.notify_moderators(self.discobot_user, post).post_action
|
||||
PostAction.defer_flags!(post, self.discobot_user)
|
||||
end
|
||||
|
||||
|
@ -523,7 +523,7 @@ module DiscourseNarrativeBot
|
||||
end
|
||||
|
||||
def like_post(post)
|
||||
PostAction.act(self.discobot_user, post, PostActionType.types[:like])
|
||||
PostActionCreator.like(self.discobot_user, post)
|
||||
end
|
||||
|
||||
def welcome_topic
|
||||
|
@ -238,7 +238,7 @@ module DiscourseNarrativeBot
|
||||
|
||||
def like_user_post
|
||||
if @post.raw.match(/thank/i)
|
||||
PostAction.act(self.discobot_user, @post, PostActionType.types[:like])
|
||||
PostActionCreator.like(self.discobot_user, @post)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -422,7 +422,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
||||
|
||||
context 'when image is not found' do
|
||||
it 'should create the right replies' do
|
||||
PostAction.act(user, post_2, PostActionType.types[:like])
|
||||
PostActionCreator.like(user, post_2)
|
||||
|
||||
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
|
||||
DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: post.id).select
|
||||
@ -503,7 +503,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
||||
.to eq(new_post.id)
|
||||
|
||||
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
|
||||
PostAction.act(user, post_2, PostActionType.types[:like])
|
||||
PostActionCreator.like(user, post_2)
|
||||
|
||||
expected_raw = <<~RAW
|
||||
#{I18n.t('discourse_narrative_bot.new_user_narrative.images.reply')}
|
||||
|
@ -656,7 +656,7 @@ describe DiscourseNarrativeBot::TrackSelector do
|
||||
user
|
||||
|
||||
expect do
|
||||
PostAction.act(user, another_post, PostActionType.types[:like])
|
||||
PostActionCreator.like(user, another_post)
|
||||
end.to_not change { Post.count }
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user