From 9153fd3559bea49d29b44a27e6fb4123dd103c25 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 12 Dec 2019 18:44:56 +0000 Subject: [PATCH] Fix link in error page when a user has public edits disabled --- app/views/site/edit.html.erb | 2 +- test/controllers/site_controller_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/site/edit.html.erb b/app/views/site/edit.html.erb index cfc28f024..769526e45 100644 --- a/app/views/site/edit.html.erb +++ b/app/views/site/edit.html.erb @@ -5,7 +5,7 @@

<%= t "layouts.osm_read_only" %>

<% elsif !current_user.data_public? %>

<%= t ".not_public" %>

-

<%= raw t ".not_public_description", :user_page => (link_to t(".user_page_link"), :controller => "user", :action => "account", :display_name => current_user.display_name, :anchor => "public") %>

+

<%= raw t ".not_public_description", :user_page => (link_to t(".user_page_link"), user_path(current_user, :anchor => "public")) %>

<%= raw t "site.edit.anon_edits", :link => link_to(t(".anon_edits_link_text"), t(".anon_edits_link")) %>

<% else %> <%= render :partial => preferred_editor %> diff --git a/test/controllers/site_controller_test.rb b/test/controllers/site_controller_test.rb index c7826062b..91fb83b67 100644 --- a/test/controllers/site_controller_test.rb +++ b/test/controllers/site_controller_test.rb @@ -170,6 +170,14 @@ class SiteControllerTest < ActionController::TestCase assert_redirected_to :controller => :users, :action => :login, :referer => "/edit" end + # Test the error when trying to edit without public edits + def test_edit_non_public + get :edit, :session => { :user => create(:user, :data_public => false) } + assert_response :success + assert_template "edit" + assert_select "a[href='https://wiki.openstreetmap.org/wiki/Disabling_anonymous_edits']" + end + # Test the right editor gets used when the user hasn't set a preference def test_edit_without_preference get :edit, :session => { :user => create(:user) } -- 2.43.2