diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 89ba5d1313..abdda5b492 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -389,7 +389,7 @@ def hide_comment # Extract the arguments id = params[:id].to_i - # Find the changeset + # Find the comment comment = ChangesetComment.find(id) # Hide the comment @@ -408,7 +408,7 @@ def unhide_comment # Extract the arguments id = params[:id].to_i - # Find the changeset + # Find the comment comment = ChangesetComment.find(id) # Unhide the comment @@ -418,6 +418,44 @@ def unhide_comment render :text => comment.changeset.to_xml.to_s, :content_type => "text/xml" end + ## + # Hide tags + def hide_tags + # Check the arguments are sane + raise OSM::APIBadUserInput.new("No id was given") unless params[:id] + + # Extract the arguments + id = params[:id].to_i + + # Find the changeset + changeset = Changeset.find(id) + + # Hide the tags + changeset.update(:tags_hidden => true) + + # Return a copy of the updated changeset + render :text => changeset.to_xml.to_s, :content_type => "text/xml" + end + + ## + # Un-Hide tags + def unhide_tags + # Check the arguments are sane + raise OSM::APIBadUserInput.new("No id was given") unless params[:id] + + # Extract the arguments + id = params[:id].to_i + + # Find the changeset + changeset = Changeset.find(id) + + # Unhide the tags + changeset.update(:tags_hidden => false) + + # Return a copy of the updated changeset + render :text => changeset.to_xml.to_s, :content_type => "text/xml" + end + ## # Get a feed of recent changeset comments def comments_feed @@ -443,6 +481,7 @@ def comments_feed render :text => "", :status => :bad_request end + private #------------------------------------------------------------ diff --git a/app/helpers/changeset_helper.rb b/app/helpers/changeset_helper.rb index 45c8be6819..b83d8ce5eb 100644 --- a/app/helpers/changeset_helper.rb +++ b/app/helpers/changeset_helper.rb @@ -31,4 +31,14 @@ def changeset_details(changeset) :user => changeset_user_link(changeset) end end + + def changeset_comment_or_nocomment(changeset, moderator = false) + if !changeset.tags['comment'].present? + t("browse.no_comment") + elsif changeset.tags_hidden and !moderator + t("browse.tags_hidden") + else + changeset.tags['comment'] + end + end end diff --git a/app/views/browse/_common_details.html.erb b/app/views/browse/_common_details.html.erb index 17a5f1f407..51a510830c 100644 --- a/app/views/browse/_common_details.html.erb +++ b/app/views/browse/_common_details.html.erb @@ -1,9 +1,5 @@