upgrades: fix Danbooru.config.user_upgrades_enabled? setting
* 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.
This commit is contained in:
@@ -28,7 +28,7 @@ class UserUpgrade < ApplicationRecord
|
||||
scope :self_upgrade, -> { where("recipient_id = purchaser_id") }
|
||||
|
||||
def self.enabled?
|
||||
Danbooru.config.user_upgrades_enabled?
|
||||
Danbooru.config.user_upgrades_enabled?.to_s.truthy?
|
||||
end
|
||||
|
||||
def self.gold_price
|
||||
|
||||
@@ -6,7 +6,7 @@ class UserUpgradePolicy < ApplicationPolicy
|
||||
end
|
||||
|
||||
def new?
|
||||
UserUpgrade.enabled?
|
||||
true
|
||||
end
|
||||
|
||||
def show?
|
||||
|
||||
@@ -107,7 +107,9 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if @user_upgrade.purchaser.is_anonymous? %>
|
||||
<% if !UserUpgrade.enabled? %>
|
||||
<%= button_to "Get #{Danbooru.config.canonical_app_name} Gold", user_upgrades_path(user_id: @recipient.id), class: "button-primary", disabled: true %>
|
||||
<% elsif @user_upgrade.purchaser.is_anonymous? %>
|
||||
<%= link_to "Get #{Danbooru.config.canonical_app_name} Gold", new_user_path(url: new_user_upgrade_path), class: "button-primary" %>
|
||||
<% elsif @user_upgrade.recipient.level <= User::Levels::MEMBER %>
|
||||
<%= button_to "Get #{Danbooru.config.canonical_app_name} Gold", user_upgrades_path(user_id: @recipient.id, upgrade_type: "gold", country: params[:country], promo: params[:promo], payment_processor: "authorize_net"), class: "button-primary", remote: true, disable_with: "Redirecting..." %>
|
||||
|
||||
Reference in New Issue
Block a user