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:
nonamethanks
2022-04-08 00:51:53 +02:00
parent 98a9b2484b
commit ea76a889db
16 changed files with 194 additions and 5 deletions

View File

@@ -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