Skip to content

Commit

Permalink
UX: update invite 'not found' message
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitjalan committed Jul 19, 2019
1 parent 2f6ce29 commit 1f1b3e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/invites_controller.rb
Expand Up @@ -35,7 +35,7 @@ def show
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
Expand Down Expand Up @@ -70,7 +70,7 @@ def perform_accept_invitation
}
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

Expand Down
3 changes: 2 additions & 1 deletion config/locales/server.en.yml
Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions spec/requests/invites_controller_spec.rb
Expand Up @@ -14,7 +14,7 @@

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
Expand Down Expand Up @@ -210,7 +210,7 @@
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
Expand Down Expand Up @@ -245,7 +245,7 @@
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
Expand Down

0 comments on commit 1f1b3e9

Please sign in to comment.