Add ability to mark tags as deprecated
* Deprecated tags can't be added to posts, but existing deprecated tags in a post won't be removed * Only empty tags can be marked as deprecated manually * No tags can be manually undeprecated ** These limits don't apply to admins * Deprecating or undeprecating a tag will create a new mod action to prevent people from going rogue * Added deprecate/undeprecate commands for BURs * Deprecating a tag via BUR removes all implications to and from it as well
This commit is contained in:
@@ -7,7 +7,14 @@ class TagPolicy < ApplicationPolicy
|
||||
(user.is_member? && record.post_count < 50)
|
||||
end
|
||||
|
||||
def can_change_deprecated_status?
|
||||
user.is_admin? || (record.post_count == 0 && !record.is_deprecated?)
|
||||
end
|
||||
|
||||
def permitted_attributes
|
||||
[(:category if can_change_category?)].compact
|
||||
[
|
||||
(:category if can_change_category?),
|
||||
(:is_deprecated if can_change_deprecated_status?),
|
||||
].compact
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user