COU-575 - Macros don't transfer (hash mismatch) due to unique id changes in courier 3.1 for Umbraco versions less than 7.6

Created by Shannon Deminick 23 May 2017, 08:05:03 Updated by Sebastiaan Janssen 23 May 2017, 11:03:14

Subtask of: COU-521

In Courier 3.1 we added support for umb 7.6 which have GUIDs for macros and Courier was coded accordingly however there was one place where this was overlooked which has caused courier 3.1+ to not work for transfering macros since the hash's will be different.

Comments

Shannon Deminick 23 May 2017, 08:08:24

Enabling the appsetting <add key="DeployHashDebug" value="true" /> will yield the hash outputs for items, in this case when transferring the same macro which had 1 macro property we'd get:

DEBUG HASH: Umbraco.Courier.ItemProviders.Macro, Alias:f7d3f07078ba428b0999399e41cb17474fda5bdf;CacheByPage:False|;CachePersonalized:False|;Dependencies:;DLRScript:39bd61c5a01bbe65bbf6ee1d691d19d1cecac199;Name:a53041b5a07ffc7d839c294c3b8d46c8b8fcc7b1;Properties:Alias:e8f40c2c255e655dba830e077aef7cbcb8105da9;EditorAlias:faff16a5fdf5d2b3aa454a15a8920552162ed389;Name:5a25a38cfaafffd2d65fbc8748285f19f61a8887;SortOrder:0|;UniqueId:4c003bd7-92ba-4743-8070-ff39ffc4b889|;;RefreshRate:0|;RenderContent:False|;UniqueId:00000000-0000-0000-0000-000000000000|;UseInEditor:True|;UserControl:;Xslt:;

and on the other environment in the same deployment we'd get

DEBUG HASH: Umbraco.Courier.ItemProviders.Macro, Alias:f7d3f07078ba428b0999399e41cb17474fda5bdf;CacheByPage:False|;CachePersonalized:False|;Dependencies:;DLRScript:39bd61c5a01bbe65bbf6ee1d691d19d1cecac199;Name:a53041b5a07ffc7d839c294c3b8d46c8b8fcc7b1;Properties:Alias:e8f40c2c255e655dba830e077aef7cbcb8105da9;EditorAlias:faff16a5fdf5d2b3aa454a15a8920552162ed389;Name:5a25a38cfaafffd2d65fbc8748285f19f61a8887;SortOrder:0|;UniqueId:c2eb7987-a8f8-4f8c-8064-6c5cd3572aba|;;RefreshRate:0|;RenderContent:False|;UniqueId:00000000-0000-0000-0000-000000000000|;UseInEditor:True|;UserControl:;Xslt:;

The difference is subtle but it's the UniqueId of the macro property.

When running < Umbraco 7.6 the UniqueIds for macros and macro properties should be consistent (based on the alias) but there was one place in the code that wasn't doing this and instead generating a new GUID for the macro/macro property.

With the fix in place this is the output:

DEBUG HASH: Umbraco.Courier.ItemProviders.Macro, Alias:f7d3f07078ba428b0999399e41cb17474fda5bdf;CacheByPage:False|;CachePersonalized:False|;Dependencies:;DLRScript:39bd61c5a01bbe65bbf6ee1d691d19d1cecac199;Name:a53041b5a07ffc7d839c294c3b8d46c8b8fcc7b1;Properties:Alias:e8f40c2c255e655dba830e077aef7cbcb8105da9;EditorAlias:faff16a5fdf5d2b3aa454a15a8920552162ed389;Name:5a25a38cfaafffd2d65fbc8748285f19f61a8887;SortOrder:0|;UniqueId:00000000-0000-0000-0000-000000000000|;;RefreshRate:0|;RenderContent:False|;UniqueId:00000000-0000-0000-0000-000000000000|;UseInEditor:True|;UserControl:;Xslt:;


Shannon Deminick 23 May 2017, 08:13:09

PR for review: https://github.com/umbraco/UmbracoDeploy/pull/96

The problem was in MacroItem.cs RetrieveItem method which was not taking into account the UmbracoCompatibilityHelper.MacrosHaveUniqueIds and generating new Guids for the Unique Ids. Now it takes this into account and will use the GetPredictableGuid method for umb versions < 7.6

To test:

  • Using Umb < 7.6 create a macro with one property, deploy this to another environment - it should work ** Then have a content item with an RTE that has this macro in it, deploy the content item - it should work
  • Using Umb >= 7.6 Do the same as the above ** Then also change the name/alias of the macro and it's property and deploy this - it should work, the macro and property should be renamed (in < 7.6 this would have created a new macro) (this is basically testing that the GUIDs are being referenced in >= 7.6)


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty:

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 3.1.2

Sprint:

Story Points:

Cycle: 1