[openstreetmap/openstreetmap-website] Validation for note transitions (Issue #4528)
mmd
notifications at github.com
Mon Jul 15 21:48:30 UTC 2024
I guess something like this should do then?
```ruby
# Close the note and add a comment
Note.transaction do
# Find the note and check it is valid
@note = Note.lock.find_by(:id => id)
raise OSM::APINotFoundError unless @note
raise OSM::APIAlreadyDeletedError.new("note", @note.id) unless @note.visible?
raise OSM::APINoteAlreadyClosedError, @note if @note.closed?
@note.close
add_comment(@note, comment, "closed")
end
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/4528#issuecomment-2229496451
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/4528/2229496451 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240715/7ca5abc4/attachment.htm>
More information about the rails-dev
mailing list