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

Anton Khorev notifications at github.com
Wed Feb 28 14:18:56 UTC 2024


@AntonKhorev commented on this pull request.



> @@ -43,7 +43,7 @@ def initialize(user)
         can [:new, :show, :create, :destroy], :oauth2_authorization
         can [:edit, :update, :destroy], :account
         can [:show], :dashboard
-        can [:new, :create, :edit, :update, :comment, :subscribe, :unsubscribe], DiaryEntry
+        can [:new, :create, :edit, :update, :comment, :subscribe, :unsubscribe, :hide, :unhide], DiaryEntry

For example, you can put this in `hide` method:

    authorize! :hide, entry

In theory there's [`load_and_authorize_resource`](https://github.com/CanCanCommunity/cancancan/blob/develop/docs/controller_helpers.md#authorize_resource-load_resource-load_and_authorize_resource) helper.

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

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


More information about the rails-dev mailing list