Fix admins being able to suspend their instance actor (#14567)

* Fix admin being able to suspend their own instance account

* Add text about the instance's own actor in admin view

* Change instance actor notice from flash message to template

* Do not list local instance actor in account moderation list
This commit is contained in:
ThibG 2020-12-15 17:23:58 +01:00 committed by GitHub
parent 8485c436d5
commit 8357969559
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 5 deletions

View file

@ -14,7 +14,7 @@ class AccountPolicy < ApplicationPolicy
end
def suspend?
staff? && !record.user&.staff?
staff? && !record.user&.staff? && !record.instance_actor?
end
def destroy?
@ -62,6 +62,6 @@ class AccountPolicy < ApplicationPolicy
end
def memorialize?
admin? && !record.user&.admin?
admin? && !record.user&.admin? && !record.instance_actor?
end
end