FEATURE: Claim Reviewables by Topic

This is a feature that used to be present in discourse-assign but is
much easier to implement in core. It also allows a topic to be assigned
without it claiming for review and vice versa and allows it to work with
category group reviewers.
This commit is contained in:
Robin Ward
2019-05-08 10:20:51 -04:00
parent 8dfb15a2e5
commit b380ed5282
30 changed files with 448 additions and 47 deletions

View File

@ -0,0 +1,20 @@
class ReviewableClaimedTopicsController < ApplicationController
requires_login
def create
topic = Topic.find_by(id: params[:reviewable_claimed_topic][:topic_id])
guardian.ensure_can_claim_reviewable_topic!(topic)
ReviewableClaimedTopic.create!(user_id: current_user.id, topic_id: topic.id)
render json: success_json
end
def destroy
topic = Topic.find_by(id: params[:id])
raise Discourse::NotFound if topic.blank?
guardian.ensure_can_claim_reviewable_topic!(topic)
ReviewableClaimedTopic.where(topic_id: topic.id).delete_all
render json: success_json
end
end