Remove CurrentUser.country.
This was Cloudflare-specific and it was only used for selecting the currency during user upgrades.
This commit is contained in:
@@ -5,7 +5,7 @@ class UserUpgradesController < ApplicationController
|
||||
|
||||
def create
|
||||
@user_upgrade = authorize UserUpgrade.create(recipient: recipient, purchaser: CurrentUser.user, status: "pending", upgrade_type: params[:upgrade_type], payment_processor: params[:payment_processor])
|
||||
@country = params[:country] || CurrentUser.country || "US"
|
||||
@country = params[:country] || "US"
|
||||
@allow_promotion_codes = params[:promo].to_s.truthy?
|
||||
@checkout = @user_upgrade.create_checkout!(country: @country, allow_promotion_codes: @allow_promotion_codes)
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ class DanbooruLogger
|
||||
name: user&.name,
|
||||
level: user&.level_string,
|
||||
#ip: request.remote_ip,
|
||||
#country: CurrentUser.country,
|
||||
#safe_mode: CurrentUser.safe_mode?,
|
||||
#bot: UserAgent.new(request.headers["HTTP_USER_AGENT"]).is_bot?,
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ class SessionLoader
|
||||
# resetting a password from an magic email link)
|
||||
#
|
||||
# Also performs post-load actions, including updating the user's last login
|
||||
# timestamp, their last used IP, their timezone, their database timeout, their
|
||||
# country, whether safe mode is enabled, their session cookie, and unbanning
|
||||
# banned users if their ban is expired.
|
||||
# timestamp, their last used IP, their timezone, their database timeout,
|
||||
# whether safe mode is enabled, their session cookie, and unbanning banned
|
||||
# users if their ban is expired.
|
||||
#
|
||||
# @see ApplicationController#set_current_user
|
||||
# @see CurrentUser
|
||||
@@ -79,7 +79,6 @@ class SessionLoader
|
||||
update_last_logged_in_at
|
||||
update_last_ip_addr
|
||||
set_time_zone
|
||||
set_country
|
||||
set_safe_mode
|
||||
set_save_data_mode
|
||||
initialize_session_cookies
|
||||
@@ -168,12 +167,6 @@ class SessionLoader
|
||||
Time.zone = CurrentUser.user.time_zone
|
||||
end
|
||||
|
||||
# Depends on Cloudflare
|
||||
# https://support.cloudflare.com/hc/en-us/articles/200168236-Configuring-Cloudflare-IP-Geolocation
|
||||
def set_country
|
||||
CurrentUser.country = request.headers["CF-IPCountry"]
|
||||
end
|
||||
|
||||
def set_safe_mode
|
||||
safe_mode = request.host.in?(Danbooru.config.safe_mode_hostnames) || params[:safe_mode].to_s.truthy? || CurrentUser.user.enable_safe_mode?
|
||||
CurrentUser.safe_mode = safe_mode
|
||||
|
||||
Reference in New Issue
Block a user