2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-10-27 16:06:43 -05:00
|
|
|
# mixin for all Guardian methods dealing with post_revisions permissions
|
|
|
|
module PostRevisionGuardian
|
|
|
|
def can_see_post_revision?(post_revision)
|
|
|
|
return false unless post_revision
|
|
|
|
return false if post_revision.hidden && !can_view_hidden_post_revisions?
|
|
|
|
|
|
|
|
can_view_edit_history?(post_revision.post)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_hide_post_revision?(post_revision)
|
|
|
|
is_staff?
|
|
|
|
end
|
|
|
|
|
2023-01-19 15:09:01 -06:00
|
|
|
def can_permanently_delete_post_revisions?
|
|
|
|
is_staff? && SiteSetting.can_permanently_delete
|
|
|
|
end
|
|
|
|
|
2014-10-27 16:06:43 -05:00
|
|
|
def can_show_post_revision?(post_revision)
|
|
|
|
is_staff?
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_view_hidden_post_revisions?
|
|
|
|
is_staff?
|
|
|
|
end
|
|
|
|
end
|