U4-9132 - Macros from packages are empty when restored

Created by Niels Hartvig 25 Oct 2016, 12:58:46 Updated by Sebastiaan Janssen 14 Nov 2016, 16:02:48

Tags: Unscheduled

Relates to: UAAS-395

If a package contains macros, only name and alias is saved when restoring the project locally. The generated courier files contain all meta data.

To reproduce install a package with macros on Cloud, then clone the site locally.

Comments

Claus Jensen 31 Oct 2016, 10:01:11

Looks like the courier file generated doesn't contain any of the meta data at all:

<Macro xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Dependencies />
    <ItemId>
        <Id>Macro1</Id>
        <ProviderId>2ab40e30-e292-11df-85ca-0800200c9a66</ProviderId>
    </ItemId>
    <Name>Macro1</Name>
    <ItemType>Item</ItemType>
    <Resources />
    <Alias>Macro1</Alias>
    <CacheByPage>false</CacheByPage>
    <CachePersonalized>false</CachePersonalized>
    <DLRScript />
    <Properties />
    <RefreshRate>0</RefreshRate>
    <RenderContent>true</RenderContent>
    <UseInEditor>false</UseInEditor>
</Macro>

and as soon as I resave the macro after installing the package - the courier file is updated to contain all of the meta data needed:

<Macro xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Dependencies />
    <ItemId>
        <Id>Macro1</Id>
        <ProviderId>2ab40e30-e292-11df-85ca-0800200c9a66</ProviderId>
    </ItemId>
    <Name>Macro1</Name>
    <ItemType>Item</ItemType>
    <Resources>
        <Resource>
            <ExtractToPath>~/Views/MacroPartials/InsertUmbracoForm.cshtml</ExtractToPath>
            <Name>~/Views/MacroPartials/InsertUmbracoForm.cshtml</Name>
            <PackageFromPath>~/Views/MacroPartials/InsertUmbracoForm.cshtml</PackageFromPath>
            <TemporaryStoragePath>/Views/MacroPartials/InsertUmbracoForm.cshtml</TemporaryStoragePath>
        </Resource>
    </Resources>
    <Alias>Macro1</Alias>
    <CacheByPage>false</CacheByPage>
    <CachePersonalized>false</CachePersonalized>
    <DLRScript>~/Views/MacroPartials/InsertUmbracoForm.cshtml</DLRScript>
    <Properties>
        <MacroProperty>
            <Alias>param1</Alias>
            <Name>Param 1</Name>
            <EditorAlias>Umbraco.Textbox</EditorAlias>
            <SortOrder>0</SortOrder>
        </MacroProperty>
    </Properties>
    <RefreshRate>0</RefreshRate>
    <RenderContent>false</RenderContent>
    <UseInEditor>false</UseInEditor>
    <UserControl />
    <Xslt />
</Macro>

I'll see what we can do to ensure the courier file generated when creating a macro via a package, actually contains the actual macro properties/parameters...


Claus Jensen 31 Oct 2016, 13:56:24

Moved this to Umb tracker instead as it is really not a Courier issue. Updated the package installer to use the new API/macroservice instead of using the old legacy macro classes.

Turns out the whole issue is that using the old legacy classes we trigger multiple saves and therefore actually initiating a save event in Courier before the actual properties/parameters/settings are added to the macro. Using the new API we don't have to trigger a save until we are actually done setting all the data.

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


Sebastiaan Janssen 14 Nov 2016, 16:02:39

Macros now get created properly as Courier files (tested with MediaInstallerTest_dasdsa (25).zip).


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty:

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.5.4

Due in version: 7.5.5

Sprint: Sprint 46

Story Points: 1

Cycle: