plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

Add remote_url(getRemoteUrl) to link content-types in navigation

Open nileshgulia1 opened this issue 1 year ago • 4 comments

When presenting a link content-type within the navigation menu, items located at the root level correctly display the remoteUrl, whereas those nested or at inner levels do not. The anticipated behavior is for remoteUrl to be returned for anonymous users.

The ongoing PR(https://github.com/plone/plone.restapi/pull/1654), adds remoteUrl in response to the get Navigation calls. I would be happy to coordinate the efforts.

nileshgulia1 avatar Feb 22 '24 17:02 nileshgulia1

https://github.com/plone/plone.restapi/blob/daabc59813e9701d10a80dd57b0cac5aabe06238/src/plone/restapi/services/contextnavigation/get.py#L384

nileshgulia1 avatar Feb 22 '24 17:02 nileshgulia1

@nileshgulia1 From what I see, the remoteUrl should be added for child items here: https://github.com/plone/plone.restapi/blob/1771c9c43b63dd0a6b29ab1339b6e8d6330876ab/src/plone/restapi/services/contextnavigation/get.py#L461

But, useRemoteUrl comes from the navtree code and it can only be true if the user is the not the creator of the link: https://github.com/plone/Products.CMFPlone/blob/97f00be8bdef1726c3e335d0fa189accfec6748e/Products/CMFPlone/browser/navtree.py#L144

Maybe I'm missing something but it would be good to understand why the existing code isn't working before we add new code.

davisagli avatar Feb 28 '24 06:02 davisagli

But, useRemoteUrl comes from the navtree code and it can only be true if the user is the not the creator of the link:

Hm.. I'm not sure if I get this. Anyway for now I customized it in our policy addon as it was a bit urgent https://github.com/eea/eea.volto.policy/pull/19 I will come back at this and try to fix it permanently. Thanks for the tips!

nileshgulia1 avatar Feb 28 '24 16:02 nileshgulia1

@nileshgulia1 In general, the design for the Link content type is to take users directly to the link target URL if the users don't have permission to edit the link, but take them to the Link content item if they have permission to edit it (otherwise they don't have a way to access the edit button)

davisagli avatar Feb 29 '24 00:02 davisagli