Remove Danbooru Winter Sale.

This commit is contained in:
evazion
2021-01-01 04:11:49 -06:00
parent 5b7894a8b2
commit 1d15ce2bcd
11 changed files with 3 additions and 61 deletions

View File

@@ -108,17 +108,13 @@ module ApplicationHelper
tag.time content || datetime, datetime: datetime, title: time.to_formatted_s, **options
end
def humanized_duration(from, to, compact: false)
def humanized_duration(from, to)
if to - from > 10.years
duration = "forever"
else
duration = distance_of_time_in_words(from, to)
end
if compact
duration = duration.gsub(/almost|about|over/, "").gsub(/less than a/, "<1").strip
end
datetime = from.iso8601 + "/" + to.iso8601
title = "#{from.strftime("%Y-%m-%d %H:%M")} to #{to.strftime("%Y-%m-%d %H:%M")}"

View File

@@ -7,13 +7,6 @@ $(function() {
e.preventDefault();
});
$("#hide-promotion-notice").on("click.danbooru", function(e) {
$("#promotion-notice").hide();
Cookie.put("hide_final_promotion_notice", "1", 3 * 60 * 60);
Cookie.put("hide_upgrade_account_notice", "1", 7 * 24 * 60 * 60);
e.preventDefault();
});
$("#hide-dmail-notice").on("click.danbooru", function(e) {
var $dmail_notice = $("#dmail-notice");
$dmail_notice.hide();

View File

@@ -404,9 +404,7 @@ class User < ApplicationRecord
end
def tag_query_limit
if is_member? && Danbooru.config.is_promotion?
1_000_000
elsif is_platinum?
if is_platinum?
Danbooru.config.base_tag_query_limit * 2
elsif is_gold?
Danbooru.config.base_tag_query_limit

View File

@@ -35,11 +35,7 @@ class UserUpgrade < ApplicationRecord
end
def self.gold_price
if Danbooru.config.is_promotion?
1500
else
2000
end
2000
end
def self.platinum_price
@@ -168,9 +164,6 @@ class UserUpgrade < ApplicationRecord
price: price_id,
quantity: 1,
}],
discounts: [{
coupon: promotion_discount_id,
}],
metadata: {
user_upgrade_id: id,
purchaser_id: purchaser.id,
@@ -228,12 +221,6 @@ 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"]

View File

@@ -70,18 +70,6 @@
<div id="page">
<%= render "users/verification_notice" %>
<% if Danbooru.config.is_promotion? && cookies[:hide_final_promotion_notice].blank? %>
<div class="notice notice-info notice-large" id="promotion-notice">
<% file = %w[provgift.png kemogift.png padoru.gif ablobgift.gif].sample %>
<%= tag.img src: "/images/#{file}", width: 24, height: 24 %>
<%= link_to "Danbooru Winter Sale", forum_topic_path(17832) %> ends in
<%= Time.use_zone("UTC") { humanized_duration(Time.zone.parse("2021-01-01"), Time.zone.now, compact: true) } %>!
Get 25% off Gold &amp; Platinum
(<%= link_to "hide", "#", id: "hide-promotion-notice" %>)
</div>
<% end %>
<% if !CurrentUser.is_anonymous? && !CurrentUser.is_gold? && cookies[:hide_upgrade_account_notice].blank? && params[:action] != "upgrade_information" %>
<%= render "users/upgrade_notice" %>
<% end %>

View File

@@ -18,14 +18,6 @@
<% else %>
<h1>Upgrade Account</h1>
<% if Danbooru.config.is_promotion? %>
<p>
<%= tag.img src: "/images/padoru.gif", width: 24, height: 24 %>
<b>Danbooru Winter Sale! Gold and Platinum upgrades are 25% off. Sale ends in <%= Time.use_zone("UTC") { humanized_duration(Time.zone.parse("2021-01-01"), Time.zone.now, compact: true) } %>.</b>
<%= tag.img src: "/images/padoru.gif", width: 24, height: 24 %>
</p>
<% end %>
<p>Upgrading your account gives you exclusive benefits and helps support
<%= Danbooru.config.canonical_app_name %>. Your support helps keep the
site ad-free for everyone!</p>
@@ -52,16 +44,10 @@
<td></td>
<td>Free</td>
<td>
<% if Danbooru.config.is_promotion? %>
<s>$20</s>
<% end %>
<%= cents_to_usd(UserUpgrade.gold_price) %>
<div class="fineprint">One time fee</div>
</td>
<td>
<% if Danbooru.config.is_promotion? %>
<s>$40</s>
<% end %>
<%= cents_to_usd(UserUpgrade.platinum_price) %>
<div class="fineprint">One time fee</div>
</td>

View File

@@ -528,12 +528,6 @@ module Danbooru
def redis_url
"redis://localhost:6379"
end
def is_promotion?
Time.use_zone("UTC") do
Time.zone.now < Time.zone.parse("2021-01-01")
end
end
end
EnvironmentConfiguration = Struct.new(:config) do

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB