Merge remote-tracking branch 'parent/main' into upstream-20240109

This commit is contained in:
KMY 2025-01-09 13:20:56 +09:00
commit d35fa72842
333 changed files with 4444 additions and 2541 deletions

View file

@ -12,7 +12,7 @@ class Admin::StatusPolicy < ApplicationPolicy
end
def show?
role.can?(:manage_reports, :manage_users) && (record.public_visibility? || record.unlisted_visibility? || record.public_unlisted_visibility? || record.reported? || viewable_through_normal_policy?)
role.can?(:manage_reports, :manage_users) && eligible_to_show?
end
def destroy?
@ -29,6 +29,10 @@ class Admin::StatusPolicy < ApplicationPolicy
private
def eligible_to_show?
record.distributable? || record.login_visibility? || record.reported? || viewable_through_normal_policy?
end
def viewable_through_normal_policy?
StatusPolicy.new(current_account, record, @preloaded_relations).show?
end

View file

@ -10,10 +10,16 @@ class UserRolePolicy < ApplicationPolicy
end
def update?
role.can?(:manage_roles) && (role.overrides?(record) || role.id == record.id)
role.can?(:manage_roles) && (role.overrides?(record) || self_editing?)
end
def destroy?
!record.everyone? && role.can?(:manage_roles) && role.overrides?(record) && role.id != record.id
!record.everyone? && role.can?(:manage_roles) && role.overrides?(record) && !self_editing?
end
private
def self_editing?
role.id == record.id
end
end