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

@ -5,6 +5,7 @@ require_dependency 'topics_bulk_action'
require_dependency 'discourse_event'
require_dependency 'rate_limiter'
require_dependency 'topic_publisher'
require_dependency 'post_action_destroyer'
class TopicsController < ApplicationController
requires_login only: [
@ -430,7 +431,7 @@ class TopicsController < ApplicationController
.where(user_id: current_user.id)
.where('topic_id = ?', topic.id).each do |pa|
PostAction.remove_act(current_user, pa.post, PostActionType.types[:bookmark])
PostActionDestroyer.destroy(current_user, pa.post, :bookmark)
end
render body: nil
@ -483,9 +484,8 @@ class TopicsController < ApplicationController
topic = Topic.find(params[:topic_id].to_i)
first_post = topic.ordered_posts.first
guardian.ensure_can_see!(first_post)
PostAction.act(current_user, first_post, PostActionType.types[:bookmark])
result = PostActionCreator.create(current_user, first_post, :bookmark)
return render_json_error(result) if result.failed?
render body: nil
end