glitch-soc/mastodon

View on GitHub
app/policies/terms_of_service_policy.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class TermsOfServicePolicy < ApplicationPolicy
  def index?
    role.can?(:manage_settings)
  end

  def create?
    role.can?(:manage_settings)
  end

  def distribute?
    record.published? && !record.notification_sent? && role.can?(:manage_settings)
  end

  def update?
    !record.published? && role.can?(:manage_settings)
  end

  def destroy?
    !record.published? && role.can?(:manage_settings)
  end
end