From 1f1b3e99d19fa1e15b739a33f4274d435537c9b3 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Fri, 19 Jul 2019 16:39:44 +0530 Subject: [PATCH] UX: update invite 'not found' message --- app/controllers/invites_controller.rb | 4 ++-- config/locales/server.en.yml | 3 ++- spec/requests/invites_controller_spec.rb | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) 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 contact staff." + not_found_json: "Your invite token is invalid. Please contact staff." not_found_template: |

Your invite to %{site_name} has already been redeemed.

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