Add Danbooru Winter Sale.

This commit is contained in:
evazion
2021-12-28 14:41:37 -06:00
parent 572b1b74f7
commit b8356c97c1
11 changed files with 76 additions and 8 deletions

View File

@@ -437,7 +437,9 @@ class User < ApplicationRecord
end
def tag_query_limit(level)
if level >= User::Levels::BUILDER
if level >= User::Levels::MEMBER && Danbooru.config.is_promotion?
Float::INFINITY
elsif level >= User::Levels::BUILDER
Float::INFINITY
elsif level == User::Levels::PLATINUM
12

View File

@@ -37,7 +37,11 @@ class UserUpgrade < ApplicationRecord
end
def self.gold_price
2000
if Danbooru.config.is_promotion?
1500
else
2000
end
end
def self.platinum_price
@@ -161,6 +165,9 @@ class UserUpgrade < ApplicationRecord
price: price_id,
quantity: 1,
}],
discounts: [{
coupon: promotion_discount_id,
}],
metadata: {
user_upgrade_id: id,
purchaser_id: purchaser.id,
@@ -218,6 +225,12 @@ class UserUpgrade < ApplicationRecord
!pending?
end
def promotion_discount_id
if Danbooru.config.is_promotion?
Danbooru.config.stripe_promotion_discount_id
end
end
def upgrade_price_id(currency)
case [upgrade_type, currency]
when ["gold", "usd"]