[openstreetmap/openstreetmap-website] Add a CanCanCan ability to see redacted versions (PR #4553)

mmd notifications at github.com
Sun Jul 7 19:56:36 UTC 2024


@mmd-osm commented on this pull request.



> @@ -54,6 +54,7 @@ def initialize(user)
         can [:index, :create, :destroy], UserMute
 
         if user.moderator?
+          can :show_redactions, [Node, Way, Relation, OldNode, OldWay, OldRelation]

Well, to link to the history, you would only need the element type, object id and the current version of the object (=latest version). Based on this info, you could generate a link to the latest version, and also to the first version, if the current version is not 1.

The actual history page data would then be provided by the old* objects: https://github.com/openstreetmap/openstreetmap-website/blob/012e752c0eae9450ff4ddf6083ad729779fd6eab/app/views/browse/history.html.erb#L5

I found it helpful to check the local PostgreSQL db and compare current_nodes and nodes table contents (representing Node and OldNode models).

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

Message ID: <openstreetmap/openstreetmap-website/pull/4553/review/2161914637 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240707/24cd5f4a/attachment.htm>


More information about the rails-dev mailing list