KevinJump/uSync-Legacy

Macro and Macro Paramter guids not sync'd

Opened this issue · 0 comments

I originally discussed this issue in Our.Umbraco here:
https://our.umbraco.com/packages/developer-tools/usync/usync/96487-macro-guids-are-not-syncd

I have reproduced the problem on two sites:

site 1:

  • Umbraco: 7.7.9
  • Courier 3.1.6
  • uSync: 4.0.2
  • uSync.Core: 6.0.2

site 2:

  • Umbraco: 7.13.1
  • Courier 3.1.5
  • uSync: 4.0.10
  • uSync.Core: 6.0.10

uSync does not store a guid when it writes out Macros to disk. This means that when macros are imported, the macro guids are not kept in sync. This will break courier if the macros are ever embedded in RTEs.

This is an example of what uSync is outputting for a macro called Test Macro with a guid on authoring of 24191f38-0134-440c-8eef-3d7b2e17eea8:

<?xml version="1.0" encoding="utf-8"?>
<macro Key="00000000-0000-0000-0000-000000000152">
  <name>Test Macro</name>
  <alias>TestMacro</alias>
  <scriptType></scriptType>
  <scriptAssembly></scriptAssembly>
  <scriptingFile>~/Views/MacroPartials/TestMacro.cshtml</scriptingFile>
  <xslt></xslt>
  <useInEditor>True</useInEditor>
  <dontRender>False</dontRender>
  <refreshRate>0</refreshRate>
  <cacheByMember>False</cacheByMember>
  <cacheByPage>False</cacheByPage>
  <properties>
    <property name="Test Param" alias="testParam" sortOrder="0" propertyType="Umbraco.Integer" />
  </properties>
</macro>

In the above xml, the macro Key does not have the correct Guid. When we import this macro into the site in a different environment, the macro will have a different guid in each environment (ex. 66567bc5-7710-47e5-a8ca-ad2c0d660422). If we put any of these macros into a rich text editor, Courier will pick up the macro as a dependency, attempt to deploy it, and run into naming collisions. The same problem happens with macro parameters. Their guids are also out of sync, but I'll bet that part would work itself out if the macro itself was able to have its guid sync'd.

I am pretty sure that this has not been a problem for us in the past. Did something change in the way that macros are handled recently?