mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 07:49:29 +00:00
Implement Instance Moderation Notes (#31529)
This commit is contained in:
17
app/policies/instance_moderation_note_policy.rb
Normal file
17
app/policies/instance_moderation_note_policy.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class InstanceModerationNotePolicy < ApplicationPolicy
|
||||
def create?
|
||||
role.can?(:manage_federation)
|
||||
end
|
||||
|
||||
def destroy?
|
||||
owner? || (role.can?(:manage_federation) && role.overrides?(record.account.user_role))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def owner?
|
||||
record.account_id == current_account&.id
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user