umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.48k stars 2.69k forks source link

Allow hiding Links box in Info app for variants #7215

Closed ronaldbarendse closed 3 years ago

ronaldbarendse commented 4 years ago

The following event should hide the 'Links' box on the 'Info' app:

EditorModelEventManager.SendingContentModel += (sender, e) => e.Model.Urls = null;

This works for invariant document types, but when using variants, the box is still shown:

Links box

It looks like the following _.filter is the culprit, as _.filter(null) will return an empty array: https://github.com/umbraco/Umbraco-CMS/blob/b8e5146baa5b9432bc2c090736f0f58bf6087876/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js#L323-L329

And the ng-if will evaluate to true for the empty array and show the box:

https://github.com/umbraco/Umbraco-CMS/blob/52dcdb396ff7d68bd76b8f276384f018fd542887/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html#L5

Umbraco version

I am seeing this issue on Umbraco version: 8.3.0

umbrabot commented 4 years ago

Hi @ronaldbarendse,

We're writing to let you know that we've added the Up For Grabs label to your issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly PR team bot :-)

ronaldbarendse commented 4 years ago

The following also adds a custom message when no URLs are available (empty array):

https://github.com/umbraco/Umbraco-CMS/blob/b8e5146baa5b9432bc2c090736f0f58bf6087876/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js#L71-L80

So to completely remove the URL box, it is required to set e.Model.Urls = null.

nathanwoulfe commented 3 years ago

Fixed in #9207