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:
Robin Ward
2019-01-03 12:03:01 -05:00
parent 9a56b398a1
commit b58867b6e9
354 changed files with 8090 additions and 5225 deletions

View File

@ -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

View File

@ -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

View File

@ -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