Merge remote-tracking branch 'openstreetmap/pull/1154'

This commit is contained in:
Tom Hughes 2016-02-15 21:09:59 +00:00
commit 3238bf567c
8 changed files with 17 additions and 3 deletions

View file

@ -1,6 +1,8 @@
module ChangesetHelper module ChangesetHelper
def changeset_user_link(changeset) def changeset_user_link(changeset)
if 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)) link_to(changeset.user.display_name, user_path(changeset.user.display_name))
else else
t("browse.anonymous") t("browse.anonymous")

View file

@ -17,6 +17,8 @@ module NoteHelper
def note_author(author, link_options = {}) def note_author(author, link_options = {})
if author.nil? if author.nil?
"" ""
elsif author.status == "deleted"
t("user.no_such_user.deleted")
else else
link_to h(author.display_name), link_options.merge(:controller => "user", :action => "view", :display_name => author.display_name) link_to h(author.display_name), link_options.merge(:controller => "user", :action => "view", :display_name => author.display_name)
end end

View file

@ -1810,6 +1810,7 @@ en:
title: "No such user" title: "No such user"
heading: "The user %{user} does not exist" 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." 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: view:
my diary: My Diary my diary: My Diary
new diary entry: new diary entry new diary entry: new diary entry

View file

@ -1574,7 +1574,7 @@ EOF
get :query, :closed => "true" get :query, :closed => "true"
assert_response :success, "can't get changesets by closed-ness" assert_response :success, "can't get changesets by closed-ness"
assert_changesets [3, 5, 6, 7, 8] assert_changesets [3, 5, 6, 7, 8, 9]
get :query, :closed => "true", :user => users(:normal_user).id get :query, :closed => "true", :user => users(:normal_user).id
assert_response :success, "can't get changesets by closed-ness and user" assert_response :success, "can't get changesets by closed-ness and user"

View file

@ -21,6 +21,13 @@ public_user_first_change:
closed_at: <%= Time.now.utc + 86400 %> closed_at: <%= Time.now.utc + 86400 %>
num_changes: 0 num_changes: 0
deleted_user_first_change:
id: 9
user_id: 11
created_at: "2007-01-01 00:00:00"
closed_at: "2007-01-02 00:00:00"
num_changes: 0
normal_user_closed_change: normal_user_closed_change:
id: 3 id: 3
user_id: 1 user_id: 1

View file

@ -6,6 +6,7 @@ class ChangesetHelperTest < ActionView::TestCase
def test_changeset_user_link def test_changeset_user_link
assert_equal "<a href=\"/user/test2\">test2</a>", changeset_user_link(changesets(:public_user_first_change)) 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(:normal_user_first_change))
assert_equal "deleted", changeset_user_link(changesets(:deleted_user_first_change))
end end
def test_changeset_details def test_changeset_details

View file

@ -15,6 +15,7 @@ class NoteHelperTest < ActionView::TestCase
def test_note_author def test_note_author
assert_equal "", note_author(nil) assert_equal "", note_author(nil)
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=\"/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) assert_equal "<a href=\"http://test.host/user/test2\">test2</a>", note_author(users(:public_user), :only_path => false)
end end

View file

@ -4,7 +4,7 @@ class ChangesetTest < ActiveSupport::TestCase
api_fixtures api_fixtures
def test_changeset_count def test_changeset_count
assert_equal 8, Changeset.count assert_equal 9, Changeset.count
end end
def test_from_xml_no_text def test_from_xml_no_text