posts: add disapproved:<reason> edit metatag.
* Allow tagging a post with a `disapproved:<disinterest|breaks_rules|poor_quality>` to disapprove it. * Disallow disapproving active posts. Fixes #4384.
This commit is contained in:
@@ -753,7 +753,7 @@ class Post < ApplicationRecord
|
||||
def filter_metatags(tags)
|
||||
@pre_metatags, tags = tags.partition {|x| x =~ /\A(?:rating|parent|-parent|-?locked):/i}
|
||||
tags = apply_categorization_metatags(tags)
|
||||
@post_metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|newpool|fav|-fav|child|-child|-favgroup|favgroup|upvote|downvote|status|-status):/i}
|
||||
@post_metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|newpool|fav|-fav|child|-child|-favgroup|favgroup|upvote|downvote|status|-status|disapproved):/i}
|
||||
apply_pre_metatags
|
||||
return tags
|
||||
end
|
||||
@@ -815,6 +815,10 @@ class Post < ApplicationRecord
|
||||
raise User::PrivilegeError unless CurrentUser.is_approver?
|
||||
unban!
|
||||
|
||||
when /^disapproved:(.+)$/i
|
||||
raise User::PrivilegeError unless CurrentUser.is_approver?
|
||||
disapprovals.create!(user: CurrentUser.user, reason: $1.downcase)
|
||||
|
||||
when /^child:none$/i
|
||||
children.each do |post|
|
||||
post.update!(parent_id: nil)
|
||||
|
||||
Reference in New Issue
Block a user