Skip to content

A platform for community discussion. Free, open, simple.

UX: update invite 'not found' message

Arpit Jalan1f1b3e99d19f
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb
index d569359b54d..cef597971f9 100644
--- a/app/controllers/invites_controller.rb
+++ b/app/controllers/invites_controller.rb
@@ -35,7 +35,7 @@ class InvitesController < ApplicationController
render layout: 'no_ember'
end
else
- flash.now[:error] = I18n.t('invite.not_found')
+ flash.now[:error] = I18n.t('invite.not_found', base_url: Discourse.base_url)
render layout: 'no_ember'
end
end
@@ -70,7 +70,7 @@ class InvitesController < ApplicationController
}
end
else
- render json: { success: false, message: I18n.t('invite.not_found') }
+ render json: { success: false, message: I18n.t('invite.not_found_json') }
end
end
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 6fa93ed7b29..4999a5f8232 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -207,7 +207,8 @@ en:
<<: *errors
invite:
- not_found: "Your invite token is invalid. Please contact the site's administrator."
+ not_found: "Your invite token is invalid. Please <a href='%{base_url}/about'>contact staff</a>."
+ not_found_json: "Your invite token is invalid. Please contact staff."
not_found_template: |
<p>Your invite to <a href="%{base_url}">%{site_name}</a> has already been redeemed.</p>
diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rb
index 8fe51106fa3..23c7f173b0f 100644
--- a/spec/requests/invites_controller_spec.rb
+++ b/spec/requests/invites_controller_spec.rb
@@ -14,7 +14,7 @@ describe InvitesController do
body = response.body
expect(body).to_not have_tag(:script, with: { src: '/assets/application.js' })
- expect(CGI.unescapeHTML(body)).to include(I18n.t('invite.not_found', site_name: SiteSetting.title, base_url: Discourse.base_url))
+ expect(CGI.unescapeHTML(body)).to include(I18n.t('invite.not_found', base_url: Discourse.base_url))
end
it "renders the accept invite page if invite exists" do
@@ -210,7 +210,7 @@ describe InvitesController do
expect(response.status).to eq(200)
json = JSON.parse(response.body)
expect(json["success"]).to eq(false)
- expect(json["message"]).to eq(I18n.t('invite.not_found'))
+ expect(json["message"]).to eq(I18n.t('invite.not_found_json'))
expect(session[:current_user_id]).to be_blank
end
end
@@ -245,7 +245,7 @@ describe InvitesController do
expect(response.status).to eq(200)
json = JSON.parse(response.body)
expect(json["success"]).to eq(false)
- expect(json["message"]).to eq(I18n.t('invite.not_found'))
+ expect(json["message"]).to eq(I18n.t('invite.not_found_json'))
expect(session[:current_user_id]).to be_blank
end
end