pundit: convert post versions to pundit.

This commit is contained in:
evazion
2020-03-19 20:35:33 -05:00
parent ba0a5dda8a
commit ffae64f127
5 changed files with 43 additions and 32 deletions

View File

@@ -0,0 +1,9 @@
class PostVersionPolicy < ApplicationPolicy
def undo?
unbanned? && record.version > 1 && record.post.present? && policy(record.post).visible?
end
def can_mass_undo?
user.is_builder?
end
end