Create new translation string for deleted user
authorAditya Prakash <aditya.prakash132@gmail.com>
Mon, 15 Feb 2016 17:05:56 +0000 (22:35 +0530)
committerAditya Prakash <aditya.prakash132@gmail.com>
Mon, 15 Feb 2016 17:07:54 +0000 (22:37 +0530)
app/helpers/changeset_helper.rb
app/helpers/note_helper.rb
config/locales/en.yml
test/helpers/changeset_helper_test.rb
test/helpers/note_helper_test.rb

index 8d49597f7527fed16670a40710788a82d4b01044..45c8be681972bf1f0a12a18a7fb2df456b3e6295 100644 (file)
@@ -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")
index 2eb809572cd51be66eaae9a62d859d30e671a313..2a101612928db938e68d3ccb51ce946cc467776a 100644 (file)
@@ -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
index ae8294e95ae3d4aacc41abc26bdb0cdff0436455..d61879a9cb234a27ee2135f33ae44f3761c666d1 100644 (file)
@@ -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
index e7ca138b665f1b6348c1db97661356375fe9abeb..8342f99d251693eefbc7ba6e58fda0d9c7b8224f 100644 (file)
@@ -6,7 +6,7 @@ class ChangesetHelperTest < ActionView::TestCase
   def test_changeset_user_link
     assert_equal "<a href=\"/user/test2\">test2</a>", 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
index e946f6f050f31939bd04a8657a651c7a7ece20f1..8495e21a9998f1b2cb52a3b7dfc53f08101a94bd 100644 (file)
@@ -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 "<a href=\"/user/test2\">test2</a>", note_author(users(:public_user))
     assert_equal "<a href=\"http://test.host/user/test2\">test2</a>", note_author(users(:public_user), :only_path => false)
   end