UX: suspend forever time period messages (#13776)

When the Forever option is selected for suspending a user, the user is suspended for 1000 years. Without customizing the site’s text, this time period is displayed to the user in the suspension email that is sent to the user, and if the user attempts to log back into the site. Telling someone that they have been suspended for 1000 years seems likely to come across as a bad attempt at humour.

This PR special case messages when a user suspended or silenced forever.
This commit is contained in:
Andrei Prigorshnev
2021-07-20 14:42:08 +04:00
committed by GitHub
parent 351ef6c2cc
commit 1a8c949900
6 changed files with 94 additions and 26 deletions

View File

@ -589,13 +589,8 @@ class SessionController < ApplicationController
end
def failed_to_login(user)
message = user.suspend_reason ? "login.suspended_with_reason" : "login.suspended"
{
error: I18n.t(message,
date: I18n.l(user.suspended_till, format: :date_only),
reason: Rack::Utils.escape_html(user.suspend_reason)
),
error: user.suspended_message,
reason: 'suspended'
}
end