[openstreetmap/openstreetmap-website] Allow users to delete their own diary entries (PR #4540)

Pablo Brasero notifications at github.com
Mon May 25 11:11:33 UTC 2026


@pablobm commented on this pull request.

> If we do true hiding, the question what supposed to happen with comments to hidden posts remains. Maybe we can do hide completely if there are no comments by other users that are not hidden, otherwise show only comments.

On this question: is there any reason to not hide the comments? The current implementation, where entry+comments are hidden as a unit, seems good to me.

> @@ -43,7 +43,7 @@ def initialize(user)
         can :read, :dashboard
         can [:read, :update], [:preferences, :profile]
         can [:create, :subscribe, :unsubscribe], DiaryEntry
-        can :update, DiaryEntry, :user => user
+        can [:update, :hide, :unhide], DiaryEntry, :user => user

I'm not familiar with CanCanCan and this declaration is confusing me.

I played with it a bit. Do I understand correctly that the `:user => user` part is only used when doing manual checks (`can?(:hide, entry)`) but not automatically with `authorize_resource`?

>      post hide_diary_entry_path(user, diary_entry)
     assert_redirected_to :controller => :errors, :action => :forbidden
     assert DiaryEntry.find(diary_entry.id).visible
 
+    # Now try as the author
+    session_for(user)

I think it's worth renaming this variable as `author` to reduce confusion. Same under `unhide`.

> @@ -554,8 +554,8 @@ en:
         other: "%{count} comments"
       no_comments: No comments
       edit_link: Edit this entry
-      hide_link: Hide this entry
-      unhide_link: Unhide this entry
+      delete_link: Delete this entry
+      restore_link: Restore this entry

I agree that "hide" and "delete" should have clearly defined meanings.

Perhaps there's another word we can use here, like "unpublish". Doesn't sound as final as "delete". Thoughts?

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

Message ID: <openstreetmap/openstreetmap-website/pull/4540/review/4354763084 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260525/8b80f34d/attachment.htm>


More information about the rails-dev mailing list