UX: update invite 'not found' message

This commit is contained in:
Arpit Jalan 2019-07-19 16:39:44 +05:30
parent 2f6ce29736
commit 1f1b3e99d1
3 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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>

View File

@ -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