Commit Graph

49 Commits

Author SHA1 Message Date
evazion
7701fe2e17 Upgrade Ruby to 3.1.2.
Also fix a call to `Time.utc` that fails in Ruby 3.1.2 (can't pass a
string to Time.utc).
2022-04-21 21:43:06 -05:00
NamelessContributor
9ca47ad29e Fix minor typo on Account Upgrade page 2022-02-23 19:14:17 +01:00
evazion
b8356c97c1 Add Danbooru Winter Sale. 2021-12-28 14:41:37 -06:00
evazion
eda23c719a votes: fixup various minor issues.
* Add a gap between thumbnails on mobile.
* Adjust CSS for scores and vote buttons.
* Include "Private favorites" as an incentive on the user upgrade page.
* Fix vote buttons not being visible beneath thumbnails on mobile.
* Fix the "Show scores" link not preserving the current page number.
* Fix vote buttons being unintentionally enabled for all thumbnails by default.
* Fix banned and restricted users being able to favorite posts by
  tagging them with `fav:self`.
* Fix search engines being able to crawl /posts?view=score pages.
* Fix broken tests.
2021-11-20 02:40:18 -06:00
evazion
7fa23c5fbf users: give all users unlimited favorites.
Let all users have unlimited favorites. Formerly the limit was 10k
favorites for regular members, 20k for Gold, and unlimited for Platinum.

Limiting favorites doesn't make sense since upvotes are unlimited.
2021-10-07 06:27:09 -05:00
evazion
bb0540e1a1 Fix #4747: BUR layout partly broken on iOS.
Move the BUR help text from the <textarea> placeholder attribute to a
<details> tag that embeds the [[help:bur_notice]] wiki page.

Also update some CSS for the <details> tag that was meant to only apply
to the user upgrades page and didn't look good here.
2021-03-05 19:53:42 -06:00
evazion
bc9e2faa9e user upgrades: fix spacing on user upgrades page. 2021-02-22 02:38:37 -06:00
evazion
1e80540a04 css: refactor CSS to use Tailwind-style utility classes.
Refactor CSS to use standard Tailwind-style utility classes instead of
ad-hoc rules. This eliminates a lot of single-purpose rules for specific
UI elements and standardizes margins to be more consistent throughout
the site.

Utility classes are defined manually on an as-needed basis instead of
importing Tailwind as a whole. Naming conventions mostly follow
Tailwind's conventions, otherwise they follow Bootstrap.

* https://tailwindcss.com/docs/
* https://getbootstrap.com/docs/5.0/utilities/spacing/
2021-02-16 09:28:38 -06:00
evazion
ae204df4ca css: factor out button css.
Factor out the buttons from the user upgrades page into a general
UI component.
2021-02-14 02:56:19 -06:00
evazion
0b2f9fafa8 users: refactor limit methods.
* Refactor various user limit methods to class methods from instance
  methods so they can be used outside the context of a single user.

* Remove the Danbooru.config.base_tag_query_limit option.
2021-01-01 19:24:37 -06:00
evazion
ecd29c1a66 user upgrades: allow using promo codes during checkout.
Allow promo codes to be used during checkout if a secret promo=true url
param is passed. Allows promo codes to be offered without having the
promo code option always appear even when there aren't any active promos.
2021-01-01 04:24:24 -06:00
evazion
1d15ce2bcd Remove Danbooru Winter Sale. 2021-01-01 04:16:38 -06:00
evazion
83d6cd5980 Update Winter Sale banner for last day. 2020-12-31 06:50:10 -06:00
evazion
d0bb4ed398 user upgrades: add bank payment methods for European countries.
Add the following bank redirect payment methods:

* https://stripe.com/docs/payments/bancontact
* https://stripe.com/docs/payments/eps
* https://stripe.com/docs/payments/giropay
* https://stripe.com/docs/payments/ideal
* https://stripe.com/docs/payments/p24

These methods are used in Austria, Belgium, Germany, the Netherlands,
and Poland.

These methods require payments to be denominated in EUR, which means we
have to set prices in both USD and EUR, and we have to automatically
detect which currency to use based on the user's country. We also have
to automatically detect which payment methods to offer based on the
user's country. We do this by using Cloudflare's CF-IPCountry header to
geolocate the user's country.

This also switches to using prices and products defined in Stripe
instead of generated on-the-fly when creating the checkout.
2020-12-31 06:50:10 -06:00
evazion
fd18291382 Add Danbooru Winter Sale. 2020-12-25 06:07:21 -06:00
evazion
069231a33b user upgrades: update upgrade landing page.
* Add a frequently asked questions section.
* Add nicer looking upgrade buttons.
* Format the page nicer.
* Prevent users from attempting invalid upgrades on users that are
  already Platinum or above.
2020-12-25 00:47:08 -06:00
evazion
74ed2a8b96 user upgrades: add UserUpgrade model.
Add a model to store the status of user upgrades.

* Store the upgrade purchaser and the upgrade receiver (these are
  different for a gifted upgrade, the same for a self upgrade).
* Store the upgrade type: gold, platinum, or gold-to-platinum upgrades.
* Store the upgrade status:
** pending: User is still on the Stripe checkout page, no payment
   received yet.
** processing: User has completed checkout, but the checkout status in
   Stripe is still 'unpaid'.
** complete: We've received notification from Stripe that the payment
   has gone through and the user has been upgraded.
* Store the Stripe checkout ID, to cross-reference the upgrade record on
  Danbooru with the checkout record on Stripe.

This is the upgrade flow:

* When the user clicks the upgrade button on the upgrade page, we call
  POST /user_upgrades and create a pending UserUpgrade.
* We redirect the user to the checkout page on Stripe.
* When the user completes checkout on Stripe, Stripe sends us a webhook
  notification at POST /webhooks/receive.
* When we receive the webhook, we check the payment status, and if it's
  paid we mark the UserUpgrade as complete and upgrade the user.
* After Stripe sees that we have successfully processed the webhook,
  they redirect the user to the /user_upgrades/:id page, where we show
  the user their upgrade receipt.
2020-12-24 21:15:04 -06:00
evazion
7762489d7d user upgrades: upgrade to new Stripe checkout system.
This upgrades from the legacy version of Stripe's checkout system to the
new version:

> The legacy version of Checkout presented customers with a modal dialog
> that collected card information, and returned a token or a source to
> your website. In contrast, the new version of Checkout is a smart
> payment page hosted by Stripe that creates payments or subscriptions. It
> supports Apple Pay, Dynamic 3D Secure, and many other features.

Basic overview of the new system:

* We send the user to a checkout page on Stripe.
* Stripe collects payment and sends us a webhook notification when the
  order is complete.
* We receive the webhook notification and upgrade the user.

Docs:

* https://stripe.com/docs/payments/checkout
* https://stripe.com/docs/payments/checkout/migration#client-products
* https://stripe.com/docs/payments/handling-payment-events
* https://stripe.com/docs/payments/checkout/fulfill-orders
2020-12-24 19:58:29 -06:00
evazion
3fea5858b1 user upgrades: update incentive descriptions.
* Call them hidden tags instead of censored tags so that users don't
  think that buying gold removes censorship from images (yes, this happened).

* Remove API ratelimit information (not relevant to most users).
2020-04-06 14:13:21 -05:00
evazion
f464163885 users: allow all users to use the posts per page setting. 2020-03-21 23:06:50 -05:00
evazion
815703a922 views: adjust more <meta> descriptions.
* Add <meta> descriptions to more pages.
* Adjust wiki/pool/forum pages to use an excerpt of the first paragraph.
2020-01-26 19:16:38 -06:00
evazion
e10bb0aab1 views: remove old matomo analytics code.
This is no longer used and shouldn't have been hardcoded anyway.
2020-01-26 19:16:38 -06:00
evazion
6a984de3d5 views: refactor page titles.
Refactor `page_title` helper to automatically include site name.
2020-01-25 01:52:18 -06:00
evazion
c251d145e4 Revert "Add Danbooru Winter Sale."
This reverts commit 963f1f7991.
2020-01-02 01:29:55 -06:00
evazion
963f1f7991 Add Danbooru Winter Sale.
* 25% off Gold and Platinum accounts.
* Free 6 tag searches for Member-level users.
* Runs from midnight Dec. 25th to 28th (UTC time).
2019-12-24 15:39:29 -06:00
evazion
ef2eb9d0f5 user upgrades: factor out gold/platinum prices. 2019-12-24 12:04:15 -06:00
evazion
82564355e6 Add better error page for database timeouts. 2019-12-16 13:38:06 -06:00
evazion
48e0569832 login: add /login & /logout routes, rename 'sign in' to 'login'.
* Replace /session/new with /login and /session/sign_out with /logout.
* Rename 'sign in' to 'login'.

This changes are to make urls cleaner and terminology more consistent.
2019-12-14 15:27:13 -06:00
evazion
56a2fae26f Revert "Temp disable account upgrades."
This reverts commit c4cdba0874.
2019-12-02 16:53:06 -06:00
evazion
c4cdba0874 Temp disable account upgrades. 2019-11-27 16:20:42 -06:00
evazion
c710aa3ffb Fix #4177: Allow all users to change their username. 2019-09-25 21:43:01 -05:00
evazion
f4512576a4 css: standardize width of fixed width pages.
Standardize various width-limited pages to 70em width.
2019-09-23 17:56:50 -05:00
evazion
31ebfa0a82 css: standardize styling of fineprint text.
Fineprint text was variously styled with `.info`, `.tn`, `.hint`, or
`.cost-footnote` css classes. Standardize on `.fineprint` instead. Use
`.hint` only for form hints and `.tn` only for <tn> tags in translation
notes.

Incidentally changes the font size of form hints to 0.8em (was 0.7em)
and the color of fineprint to #888 (was #AAA or #666).
2019-09-17 00:28:41 -05:00
evazion
62b89e1f9a user upgrades: make upgrade page visible to logged out users. 2019-09-09 17:42:46 -05:00
Albert Yi
5493e16f04 tweak matomo tracking 2018-11-12 10:28:48 -08:00
Albert Yi
684e2bdbad fix undefined _paq references 2018-11-09 15:49:42 -08:00
Albert Yi
c8793457cb remove mixpanel + add more matomo tracking 2018-11-09 15:40:38 -08:00
Albert Yi
4219163042 add mixpanel tracking for clicking stripe buttons 2018-11-02 17:03:24 -07:00
Albert Yi
5097babfaa add opt out for mixpanel tracking 2018-10-22 16:01:39 -07:00
Type-kun
7b05b9dd64 Update upgrade page (fix #3213) 2017-07-11 18:06:28 +05:00
evazion
d5b9b7162c /user_upgrades/new: fix page wrapper id.
* Move related css to user_upgrades.scss.
* Delete users/upgrade_information.html.erb as it is unused.
2017-05-22 13:07:31 -05:00
Albert Yi
1314239326 remove coinbase references 2016-12-02 13:52:39 -08:00
r888888888
c2e0dc7b08 disable coinbase payments 2015-08-10 15:07:18 -07:00
r888888888
2042d11487 fixes #2094: Upgrade info page: ads 2015-08-04 17:32:20 -07:00
r888888888
b2b14cba98 add stripe integration for safebooru 2015-01-22 16:20:25 -08:00
r888888888
cb1be62577 allow gift upgrades for accounts 2014-12-10 10:21:10 -08:00
r888888888
26fb28f8e3 implement coinbase integration 2014-11-25 16:12:24 -08:00
r888888888
d9153769b8 remove stripe references 2014-11-24 19:13:21 -08:00
r888888888
cbf48ad948 add stripe integration for safebooru 2014-11-06 17:03:17 -08:00