* Fix it so that if upgrades are disabled, only the payment button is disabled instead of the whole page. * Fix it so that disabling upgrades with DANBOORU_USER_UPGRADES_ENABLED="false" works.
28 lines
462 B
Ruby
28 lines
462 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UserUpgradePolicy < ApplicationPolicy
|
|
def create?
|
|
!user.is_anonymous?
|
|
end
|
|
|
|
def new?
|
|
true
|
|
end
|
|
|
|
def show?
|
|
record.recipient == user || record.purchaser == user || user.is_owner?
|
|
end
|
|
|
|
def refund?
|
|
user.is_owner? && record.complete?
|
|
end
|
|
|
|
def receipt?
|
|
(record.purchaser == user || user.is_owner?) && record.has_receipt?
|
|
end
|
|
|
|
def payment?
|
|
user.is_owner? && record.has_payment?
|
|
end
|
|
end
|