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")
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
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
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
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