Add ability to view previous edits of a status in admin UI (#19462)
* Add ability to view previous edits of a status in admin UI * Change moderator access to posts to be controlled by a separate policy
This commit is contained in:
parent
dee69be60e
commit
f8ca3bb2a1
16 changed files with 232 additions and 55 deletions
29
app/policies/admin/status_policy.rb
Normal file
29
app/policies/admin/status_policy.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Admin::StatusPolicy < ApplicationPolicy
|
||||
def initialize(current_account, record, preloaded_relations = {})
|
||||
super(current_account, record)
|
||||
|
||||
@preloaded_relations = preloaded_relations
|
||||
end
|
||||
|
||||
def index?
|
||||
role.can?(:manage_reports, :manage_users)
|
||||
end
|
||||
|
||||
def show?
|
||||
role.can?(:manage_reports, :manage_users) && (record.public_visibility? || record.unlisted_visibility? || record.reported?)
|
||||
end
|
||||
|
||||
def destroy?
|
||||
role.can?(:manage_reports)
|
||||
end
|
||||
|
||||
def update?
|
||||
role.can?(:manage_reports)
|
||||
end
|
||||
|
||||
def review?
|
||||
role.can?(:manage_taxonomies)
|
||||
end
|
||||
end
|
|
@ -7,10 +7,6 @@ class StatusPolicy < ApplicationPolicy
|
|||
@preloaded_relations = preloaded_relations
|
||||
end
|
||||
|
||||
def index?
|
||||
role.can?(:manage_reports, :manage_users)
|
||||
end
|
||||
|
||||
def show?
|
||||
return false if author.suspended?
|
||||
|
||||
|
@ -32,17 +28,13 @@ class StatusPolicy < ApplicationPolicy
|
|||
end
|
||||
|
||||
def destroy?
|
||||
role.can?(:manage_reports) || owned?
|
||||
owned?
|
||||
end
|
||||
|
||||
alias unreblog? destroy?
|
||||
|
||||
def update?
|
||||
role.can?(:manage_reports) || owned?
|
||||
end
|
||||
|
||||
def review?
|
||||
role.can?(:manage_taxonomies)
|
||||
owned?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue