From 80c46f54d4930deacb8664ff44703b8c3c5d088e Mon Sep 17 00:00:00 2001 From: Aditya Prakash Date: Mon, 15 Feb 2016 22:35:56 +0530 Subject: [PATCH] Create new translation string for deleted user --- app/helpers/changeset_helper.rb | 4 +++- app/helpers/note_helper.rb | 2 +- config/locales/en.yml | 1 + test/helpers/changeset_helper_test.rb | 2 +- test/helpers/note_helper_test.rb | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/helpers/changeset_helper.rb b/app/helpers/changeset_helper.rb index 8d49597f7..45c8be681 100644 --- a/app/helpers/changeset_helper.rb +++ b/app/helpers/changeset_helper.rb @@ -1,6 +1,8 @@ module ChangesetHelper def changeset_user_link(changeset) - if changeset.user.status != "deleted" && changeset.user.data_public? + if changeset.user.status == "deleted" + t("user.no_such_user.deleted") + elsif changeset.user.data_public? link_to(changeset.user.display_name, user_path(changeset.user.display_name)) else t("browse.anonymous") diff --git a/app/helpers/note_helper.rb b/app/helpers/note_helper.rb index 2eb809572..2a1016129 100644 --- a/app/helpers/note_helper.rb +++ b/app/helpers/note_helper.rb @@ -18,7 +18,7 @@ module NoteHelper if author.nil? "" elsif author.status == "deleted" - t("browse.anonymous") + t("user.no_such_user.deleted") else link_to h(author.display_name), link_options.merge(:controller => "user", :action => "view", :display_name => author.display_name) end diff --git a/config/locales/en.yml b/config/locales/en.yml index ae8294e95..d61879a9c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1810,6 +1810,7 @@ en: title: "No such user" heading: "The user %{user} does not exist" body: "Sorry, there is no user with the name %{user}. Please check your spelling, or maybe the link you clicked is wrong." + deleted: "deleted" view: my diary: My Diary new diary entry: new diary entry diff --git a/test/helpers/changeset_helper_test.rb b/test/helpers/changeset_helper_test.rb index e7ca138b6..8342f99d2 100644 --- a/test/helpers/changeset_helper_test.rb +++ b/test/helpers/changeset_helper_test.rb @@ -6,7 +6,7 @@ class ChangesetHelperTest < ActionView::TestCase def test_changeset_user_link assert_equal "test2", changeset_user_link(changesets(:public_user_first_change)) assert_equal "anonymous", changeset_user_link(changesets(:normal_user_first_change)) - assert_equal "anonymous", changeset_user_link(changesets(:deleted_user_first_change)) + assert_equal "deleted", changeset_user_link(changesets(:deleted_user_first_change)) end def test_changeset_details diff --git a/test/helpers/note_helper_test.rb b/test/helpers/note_helper_test.rb index e946f6f05..8495e21a9 100644 --- a/test/helpers/note_helper_test.rb +++ b/test/helpers/note_helper_test.rb @@ -15,7 +15,7 @@ class NoteHelperTest < ActionView::TestCase def test_note_author assert_equal "", note_author(nil) - assert_equal "anonymous", note_author(users(:deleted_user)) + assert_equal "deleted", note_author(users(:deleted_user)) assert_equal "test2", note_author(users(:public_user)) assert_equal "test2", note_author(users(:public_user), :only_path => false) end -- 2.39.5