mirror of
https://github.com/discourse/discourse.git
synced 2026-07-29 15:54:48 -05: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:
co-authored by
romanrizzi
jjaffeux
parent
9a56b398a1
commit
b58867b6e9
+3
-5
@@ -292,8 +292,8 @@ class PostRevisor
|
||||
end
|
||||
|
||||
def ninja_edit?
|
||||
return false if @post.has_active_flag?
|
||||
return false if (@revised_at - @last_version_at) > SiteSetting.editing_grace_period.to_i
|
||||
return false if @post.reviewable_flag.present?
|
||||
|
||||
if new_raw = @fields[:raw]
|
||||
|
||||
@@ -343,18 +343,16 @@ class PostRevisor
|
||||
prev_owner = User.find(@post.user_id)
|
||||
new_owner = User.find(@fields["user_id"])
|
||||
|
||||
# UserActionCreator will create new UserAction records for the new owner
|
||||
|
||||
UserAction.where(target_post_id: @post.id)
|
||||
.where(user_id: prev_owner.id)
|
||||
.where(action_type: USER_ACTIONS_TO_REMOVE)
|
||||
.destroy_all
|
||||
.update_all(user_id: new_owner.id)
|
||||
|
||||
if @post.post_number == 1
|
||||
UserAction.where(target_topic_id: @post.topic_id)
|
||||
.where(user_id: prev_owner.id)
|
||||
.where(action_type: UserAction::NEW_TOPIC)
|
||||
.destroy_all
|
||||
.update_all(user_id: new_owner.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user