From 669ba6fc8dc17b848b98e26cbb5833b034dc67a2 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 6 Dec 2019 02:26:11 -0600 Subject: [PATCH] upgrades: fix post-upgrade landing page. * Fix the post-upgrade message showing the gift message instead of the normal upgrade message. * Link back to Danbooru so people don't stay on Safebooru and get confused when they can't see hidden posts. --- app/controllers/user_upgrades_controller.rb | 6 +++++- app/views/user_upgrades/show.html.erb | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/user_upgrades_controller.rb b/app/controllers/user_upgrades_controller.rb index 1c01cc0e0..17b2fa404 100644 --- a/app/controllers/user_upgrades_controller.rb +++ b/app/controllers/user_upgrades_controller.rb @@ -55,6 +55,10 @@ class UserUpgradesController < ApplicationController flash[:error] = e.message end - redirect_to user_upgrade_path(user_id: params[:user_id]) + if @user == CurrentUser.user + redirect_to user_upgrade_path + else + redirect_to user_upgrade_path(user_id: params[:user_id]) + end end end diff --git a/app/views/user_upgrades/show.html.erb b/app/views/user_upgrades/show.html.erb index 018c0d760..d9214b97f 100644 --- a/app/views/user_upgrades/show.html.erb +++ b/app/views/user_upgrades/show.html.erb @@ -3,13 +3,13 @@ <% if flash[:success] %>

Congratulations!

- <% if params[:user_id] %> -

<%= user.name %> is now a <%= user.level_string %> level account. Thanks for supporting the site!

+ <% if user != CurrentUser.user %> +

<%= user.name %> is now a <%= user.level_string %> user. Thanks for supporting the site!

<% else %> -

You are now a <%= user.level_string %> level account. Thanks for supporting the site!

+

You are now a <%= user.level_string %> user. Thanks for supporting the site!

<% end %> -

<%= link_to "Return to posts", posts_path %>

+

<%= link_to "Go back to #{Danbooru.config.canonical_app_name}", "https://danbooru.donmai.us" %> to start using your new account.

<% elsif flash[:error] %>

An error occurred!

<%= flash[:error] %>