U4-10524 - Show warning in UI for the media/content picker that is referencing a trashed or deleted item

Created by Shannon Deminick 11 Oct 2017, 00:18:14 Updated by Anders Brohäll 20 Oct 2017, 11:50:23

Tags: Unscheduled

Relates to: U4-10533

Relates to: U4-10563

Subtask of: U4-9609

In cases where editors have picked a content or media item and then later trash or delete those picked items, we need to show a warning in the UI for these pickers that they are referencing a trashed or deleted item.

2 Attachments

Download umbraco.controllers.js

Comments

Claus Jensen 12 Oct 2017, 09:45:26

PR: https://github.com/umbraco/Umbraco-CMS/pull/2239

The media picker has been fixed to show trashed items as faded thumbnails.

It will also display "fake" items for anything being picked but deleted - to ensure this is not just removed/unpicked when resaving the item. It could potentially be restored later, so we don't want the picked value to differ just because it is saved while the item is unavailable.

The ''Add'' button has been fixed so it is now inline with the items instead of below (it was taking up a lot of space).

Warnings have been added to the picker to indicate that it has items that are currently either deleted or trashed - this will encourage you to take a decision about what to do with these items when looking at the picker.

UI changed a bit for content picker having trashed items selected: it will now show ''Recycle Bin'' instead of a path/url based on its position in trash (which wasn't correct anyway) for items that are trashed.

'''NOTE: I had to fix a automapper mapping of EntityBasic (see commit) .. I am not sure why the Trashed property was ignored - but it would be good to do some random testing of other entities by browsing around the various sections creating/viewing stuff - just to be sure things that doesn't have trash functionality hasn't broken.'''


Shannon Deminick 13 Oct 2017, 05:48:13

One issue, you get JS errors because we're trying to resolve the file from the deleted entity but we can't


Shannon Deminick 13 Oct 2017, 05:51:21

fixed in rev: ca57b9c5e69e24cc61929bfe572a51d14a893ce9


Shannon Deminick 13 Oct 2017, 06:02:21

Have tested with the old and new media/content/mntp pickers i've created a separate issue to tackle the link picker since that isn't in place: http://issues.umbraco.org/issue/U4-10533

The 'trashed' value being ignored was probably just cuz it wasn't used, there's very few references in js for that property and all look fine so the mapping is ok.

Code/tests, etc.. look good, will merge


Claus Jensen 13 Oct 2017, 06:25:11

Ahhh crap - I forgot that last commit with the last changes I did for the link picker just before doing the demo :) .. I'll fix it up in the new issue. Thanks for fixing the js error!


Anders Brohäll 17 Oct 2017, 12:25:16

I get the warning "You have picked a media item currently deleted or in the recycle bin" on (all) Media Items that isn't deleted after upgrading to 7.7.3. Using the obsolete Umbraco.MultipleMediaPicker though, but it's a legacy system that I can't rally switch data type on. Is that message expected?


Claus Jensen 17 Oct 2017, 21:56:50

@anders Thanks for reporting - it is definitely not supposed to work like that and I have located and fixed the bug.

You can see the change made here - it will be included in the next release: https://github.com/umbraco/Umbraco-CMS/commit/0688835ac0a35e3ae76fc0db2566fdd2266e7c23


Anders Brohäll 18 Oct 2017, 11:49:30

@claus Excellent! Thank you!


Sebastiaan Janssen 18 Oct 2017, 18:34:37

In the mean time can you test with the attached updated javascript file, overwrite the umbraco.controllers.js file in the ~/Umbraco/Js folder with this one and try again. Note: you will likely have to change the version number in your ClientDependency.config file for this change to have effect. If it still doesn't work, then try it in a different browser (to prevent problems with caching in your current browser).


Simon Steed 19 Oct 2017, 17:12:42

@sebastiaan Seems to be working for me. I was getting the 'You have picked a media item currently deleted or in the recycle bin' message showing after upgrading 4.11.10 -> 7.7.3 - copied over the controllers file, tried incognito and it worked. Then tried clearing cache on original browser and it worked there also.


Anders Brohäll 20 Oct 2017, 11:50:23

@sebastiaan can't really implement the fix. I have to roll back if I upgrade. We're on a continuous integration setup and I don't want to implement code from outside the nuget repos. I'll simply wait until 7.7.4 :)


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.6.9

Due in version: 7.7.3, 7.6.10

Sprint: Sprint 69

Story Points: 2

Cycle: 5