[openstreetmap/openstreetmap-website] Show notes with no visible comments; show only first comment as note description (PR #3608)

Anton Khorev notifications at github.com
Wed Jul 20 16:32:08 UTC 2022


* Note description is not shown if there are no visible comments or if the first visible comment is not the first actual comment. In the latter case the first visible comment is shown below "Created by", "Location" etc along with regular comments.
* Since reading `note.author` may cause a crash, don't read it, use `note.all_comments.first.author` instead. `note.all_comments.last.author` was already in use. If this user is deleted, the comment will be shown as "by deleted".

This should allow not to crash on notes without comments, fixing #2146 (and #2176 should not be required).

That's not a complete fix for notes without comments because some client-side js expects comments to be present.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/3608

-- Commit Summary --

  * Don't show note description if all comments are hidden
  * Don't show first visible comment as a description if it's not the first actual comment
  * Don't access note.author because it's unreliable

-- File Changes --

    M app/controllers/browse_controller.rb (1)
    M app/views/browse/note.html.erb (18)
    M test/controllers/browse_controller_test.rb (32)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/3608.patch
https://github.com/openstreetmap/openstreetmap-website/pull/3608.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3608
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3608 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220720/57554cda/attachment-0001.htm>


More information about the rails-dev mailing list