mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Merge commit '34cd7d6585992c03298c175ab5d22ad059b58cdb' into glitch-soc/merge-upstream
Conflicts: - `CONTRIBUTING.md`: Upstream changed the file, while we had a different one. Updated the common parts. - `README.md`: Upstream changed the file, while we had a different one. Updated the common parts. - `app/helpers/application_helper.rb`: Upstream added helpers where glitch-soc had extra ones. Added upstream's new helpers. - `app/models/form/admin_settings.rb`: Upstream added some custom handling of one setting, while glitch-soc had additional code. Ported upstream's code. - `lib/mastodon/version.rb`: Upstream moved some things to `config/mastodon.yml`. Did the same. - `spec/requests/api/v1/accounts/credentials_spec.rb`: I don't know honestly.
This commit is contained in:
@@ -6,7 +6,7 @@ class AccountWarningPolicy < ApplicationPolicy
|
||||
end
|
||||
|
||||
def appeal?
|
||||
target? && record.created_at >= Appeal::MAX_STRIKE_AGE.ago
|
||||
target? && record.appeal_eligible?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -12,7 +12,7 @@ class Admin::StatusPolicy < ApplicationPolicy
|
||||
end
|
||||
|
||||
def show?
|
||||
role.can?(:manage_reports, :manage_users) && (record.public_visibility? || record.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.reported? || viewable_through_normal_policy?
|
||||
end
|
||||
|
||||
def viewable_through_normal_policy?
|
||||
StatusPolicy.new(current_account, record, @preloaded_relations).show?
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user