hummingbird-me/kitsu-server

View on GitHub
app/policies/review_policy.rb

Summary

Maintainability
A
0 mins
Test Coverage
D
66%
class ReviewPolicy < ApplicationPolicy
  administrated_by :community_mod

  def create?
    user.registered? && is_owner?
  end

  def update?
    is_owner? || can_administrate?
  end

  alias_method :destroy?, :update?

  def editable_attributes(all)
    all - [:content_formatted]
  end

  class Scope < Scope
    def resolve
      scope.where.not(user_id: blocked_users)
    end
  end
end