diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 64ed88c7..a461e1c1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,10 +30,13 @@ class ApplicationController < ActionController::Base # obligatory '2001: A Space Odyssey' reference flash[:notice] = t("user.sessions.create.banned", name:) current_ban = current_user.bans.current.first - unless current_ban&.reason.nil? + unless current_ban&.reason.empty? flash[:notice] += "\n#{t('user.sessions.create.reason', reason: current_ban.reason)}" end - unless current_ban&.permanent? + + if current_ban&.permanent? + flash[:notice] += "\n#{t('user.sessions.create.permanent')}" + else # TODO format banned_until flash[:notice] += "\n#{t('user.sessions.create.until', time: current_ban.expires_at)}" end diff --git a/config/locales/controllers.en.yml b/config/locales/controllers.en.yml index a47878c0..3287e6fe 100644 --- a/config/locales/controllers.en.yml +++ b/config/locales/controllers.en.yml @@ -173,6 +173,7 @@ en: sessions: create: banned: "I'm sorry, %{name}, I'm afraid I can't do that." + permanent: "You are banned permanently." reason: "Ban reason: %{reason}" until: "Banned until: %{time}" info: