diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index f6b89456285..bdff1454de3 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -52,7 +52,11 @@ class InvitesController < ApplicationController flash.now[:error] = if invite.blank? I18n.t('invite.not_found', base_url: Discourse.base_url) elsif invite.redeemed? - I18n.t('invite.not_found_template', site_name: SiteSetting.title, base_url: Discourse.base_url) + if invite.is_invite_link? + I18n.t('invite.not_found_template_link', site_name: SiteSetting.title, base_url: Discourse.base_url) + else + I18n.t('invite.not_found_template', site_name: SiteSetting.title, base_url: Discourse.base_url) + end elsif invite.expired? I18n.t('invite.expired', base_url: Discourse.base_url) end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 4e1ca38f6b0..47b69810a61 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -236,6 +236,8 @@ en:
If you remember your password you can Log In.
Otherwise please Reset Password.
+ not_found_template_link: | +The invitation to %{site_name} can no longer be redeemed. Please ask the person who invited you to send you a new invitation.
error_message: "There was an error accepting invite. Please contact the site's administrator." user_exists: "There's no need to invite %{email}, they already have an account!" confirm_email: "You’re almost done! We sent an activation mail to your email address. Please follow the instructions in the mail to activate your account.
If it doesn’t arrive, check your spam folder.
" diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rb index 5bd12892242..6e3d810f247 100644 --- a/spec/requests/invites_controller_spec.rb +++ b/spec/requests/invites_controller_spec.rb @@ -74,12 +74,19 @@ describe InvitesController do end it 'returns error if invite has already been redeemed' do - Fabricate(:invited_user, invite: invite, user: Fabricate(:user)) + expect(invite.redeem).not_to eq(nil) get "/invites/#{invite.invite_key}" expect(response.status).to eq(200) expect(response.body).to_not have_tag(:script, with: { src: '/assets/application.js' }) expect(response.body).to include(I18n.t('invite.not_found_template', site_name: SiteSetting.title, base_url: Discourse.base_url)) + + invite.update!(email: nil) # convert to email invite + + get "/invites/#{invite.invite_key}" + expect(response.status).to eq(200) + expect(response.body).to_not have_tag(:script, with: { src: '/assets/application.js' }) + expect(response.body).to include(I18n.t('invite.not_found_template_link', site_name: SiteSetting.title, base_url: Discourse.base_url)) end end