Add FIXME to content type sort + rearrange constructor parameters

This commit is contained in:
kjac
2023-02-18 13:58:02 +01:00
parent 323a1b731b
commit 0bc08e6a91
9 changed files with 18 additions and 18 deletions

View File

@@ -21,7 +21,8 @@ public class ContentTypeSort : IValueObject, IDeepCloneable
SortOrder = sortOrder;
}
public ContentTypeSort(Lazy<int> id, int sortOrder, string alias, Guid key)
// FIXME: remove integer ID in constructor
public ContentTypeSort(Lazy<int> id, Guid key, int sortOrder, string alias)
{
Id = id;
SortOrder = sortOrder;

View File

@@ -1176,8 +1176,7 @@ namespace Umbraco.Cms.Infrastructure.Packaging
continue;
}
allowedChildren?.Add(new ContentTypeSort(new Lazy<int>(() => allowedChild.Id), sortOrder,
allowedChild.Alias, allowedChild.Key));
allowedChildren?.Add(new ContentTypeSort(new Lazy<int>(() => allowedChild.Id), allowedChild.Key, sortOrder, allowedChild.Alias));
sortOrder++;
}

View File

@@ -129,9 +129,9 @@ internal class ContentTypeCommonRepository : IContentTypeCommonRepository
allowedContentTypes.Add(new ContentTypeSort(
new Lazy<int>(() => allowedDto.AllowedId),
key,
allowedDto.SortOrder,
alias!,
key));
alias!));
allowedDtoIx++;
}

View File

@@ -217,7 +217,7 @@ public class LoadTestController : Controller
};
containerType.AllowedContentTypes = containerType.AllowedContentTypes.Union(new[]
{
new ContentTypeSort(new Lazy<int>(() => contentType.Id), 0, contentType.Alias, contentType.Key)
new ContentTypeSort(new Lazy<int>(() => contentType.Id), contentType.Key, 0, contentType.Alias)
});
containerType.AllowedTemplates = containerType.AllowedTemplates.Union(new[] { containerTemplate });
containerType.SetDefaultTemplate(containerTemplate);

View File

@@ -53,6 +53,6 @@ public class ContentTypeSortBuilder
var sortOrder = _sortOrder ?? 0;
var key = Guid.NewGuid();
return new ContentTypeSort(new Lazy<int>(() => id), sortOrder, alias, key);
return new ContentTypeSort(new Lazy<int>(() => id), key, sortOrder, alias);
}
}

View File

@@ -809,8 +809,8 @@ public class ContentTypeRepositoryTest : UmbracoIntegrationTest
var contentType = repository.Get(_simpleContentType.Id);
contentType.AllowedContentTypes = new List<ContentTypeSort>
{
new(new Lazy<int>(() => subpageContentType.Id), 0, subpageContentType.Alias, subpageContentType.Key),
new(new Lazy<int>(() => simpleSubpageContentType.Id), 1, simpleSubpageContentType.Alias, simpleSubpageContentType.Key)
new(new Lazy<int>(() => subpageContentType.Id), subpageContentType.Key, 0, subpageContentType.Alias),
new(new Lazy<int>(() => simpleSubpageContentType.Id), simpleSubpageContentType.Key, 1, simpleSubpageContentType.Alias)
};
repository.Save(contentType);

View File

@@ -70,18 +70,18 @@ public class ContentServicePerformanceTest : UmbracoIntegrationTest
ContentTypeService.Save(new[] { contentType1, contentType2, contentType3 });
contentType1.AllowedContentTypes = new[]
{
new ContentTypeSort(new Lazy<int>(() => contentType2.Id), 0, contentType2.Alias, contentType2.Key),
new ContentTypeSort(new Lazy<int>(() => contentType3.Id), 1, contentType3.Alias, contentType3.Key)
new ContentTypeSort(new Lazy<int>(() => contentType2.Id), contentType2.Key, 0, contentType2.Alias),
new ContentTypeSort(new Lazy<int>(() => contentType3.Id), contentType3.Key, 1, contentType3.Alias)
};
contentType2.AllowedContentTypes = new[]
{
new ContentTypeSort(new Lazy<int>(() => contentType1.Id), 0, contentType1.Alias, contentType1.Key),
new ContentTypeSort(new Lazy<int>(() => contentType3.Id), 1, contentType3.Alias, contentType3.Key)
new ContentTypeSort(new Lazy<int>(() => contentType1.Id), contentType1.Key, 0, contentType1.Alias),
new ContentTypeSort(new Lazy<int>(() => contentType3.Id), contentType3.Key, 1, contentType3.Alias)
};
contentType3.AllowedContentTypes = new[]
{
new ContentTypeSort(new Lazy<int>(() => contentType1.Id), 0, contentType1.Alias, contentType1.Key),
new ContentTypeSort(new Lazy<int>(() => contentType2.Id), 1, contentType2.Alias, contentType2.Key)
new ContentTypeSort(new Lazy<int>(() => contentType1.Id), contentType1.Key, 0, contentType1.Alias),
new ContentTypeSort(new Lazy<int>(() => contentType2.Id), contentType2.Key, 1, contentType2.Alias)
};
ContentTypeService.Save(new[] { contentType1, contentType2, contentType3 });

View File

@@ -652,7 +652,7 @@ public class ContentServiceTagsTests : UmbracoIntegrationTest
CreateAndAddTagsPropertyType(contentType);
ContentTypeService.Save(contentType);
contentType.AllowedContentTypes =
new[] { new ContentTypeSort(new Lazy<int>(() => contentType.Id), 0, contentType.Alias, contentType.Key) };
new[] { new ContentTypeSort(new Lazy<int>(() => contentType.Id), contentType.Key, 0, contentType.Alias) };
var content = ContentBuilder.CreateSimpleContent(contentType, "Tagged content");
content.AssignTags(PropertyEditorCollection, DataTypeService, Serializer, "tags",

View File

@@ -1843,7 +1843,7 @@ public class ContentServiceTests : UmbracoIntegrationTestWithContent
ContentTypeBuilder.CreateSimpleContentType("umbTextpage1", "Textpage", defaultTemplateId: template.Id);
contentType.AllowedContentTypes = new List<ContentTypeSort>
{
new(new Lazy<int>(() => contentType.Id), 0, contentType.Alias, contentType.Key)
new(new Lazy<int>(() => contentType.Id), contentType.Key, 0, contentType.Alias)
};
ContentTypeService.Save(contentType);
@@ -1883,7 +1883,7 @@ public class ContentServiceTests : UmbracoIntegrationTestWithContent
ContentTypeBuilder.CreateSimpleContentType("umbTextpage1", "Textpage", defaultTemplateId: template.Id);
contentType.AllowedContentTypes = new List<ContentTypeSort>
{
new(new Lazy<int>(() => contentType.Id), 0, contentType.Alias, contentType.Key)
new(new Lazy<int>(() => contentType.Id), contentType.Key, 0, contentType.Alias)
};
ContentTypeService.Save(contentType);