From ce372abf8a87398e0a8d485f86caf00567e9ef73 Mon Sep 17 00:00:00 2001 From: Ethan Nagano <50598649+nagolucky18@users.noreply.github.com> Date: Mon, 25 Mar 2024 06:27:36 -0700 Subject: [PATCH 1/5] Add check for ContentVariation.Nothing when copying documents. (#15185) A new check for ContentVariation.Nothing is necessary when copying from documents to ensure that if there is no content variation as defined by the Nothing property, values are still copied even if variation is not supported since the content itself will not vary. --- .../Models/ContentRepositoryExtensions.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs b/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs index 5b7d68a72b..24fd7847b4 100644 --- a/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs +++ b/src/Umbraco.Core/Models/ContentRepositoryExtensions.cs @@ -174,15 +174,17 @@ public static class ContentRepositoryExtensions foreach (IProperty property in content.Properties) { // each property type may or may not support the variation - if (!property.PropertyType?.SupportsVariation(culture, "*", true) ?? false) + if ((!property.PropertyType?.SupportsVariation(culture, "*", true) ?? false) && + !(property.PropertyType?.Variations == ContentVariation.Nothing)) { continue; } foreach (IPropertyValue pvalue in property.Values) { - if ((property.PropertyType?.SupportsVariation(pvalue.Culture, pvalue.Segment, true) ?? false) && - (culture == "*" || (pvalue.Culture?.InvariantEquals(culture) ?? false))) + if (((property.PropertyType?.SupportsVariation(pvalue.Culture, pvalue.Segment, true) ?? false) && + (culture == "*" || (pvalue.Culture?.InvariantEquals(culture) ?? false))) || + property.PropertyType?.Variations == ContentVariation.Nothing) { property.SetValue(null, pvalue.Culture, pvalue.Segment); } @@ -193,7 +195,8 @@ public static class ContentRepositoryExtensions IPropertyCollection otherProperties = other.Properties; foreach (IProperty otherProperty in otherProperties) { - if (!otherProperty?.PropertyType?.SupportsVariation(culture, "*", true) ?? true) + if ((!otherProperty?.PropertyType?.SupportsVariation(culture, "*", true) ?? true) && + !(otherProperty?.PropertyType?.Variations == ContentVariation.Nothing)) { continue; } @@ -203,8 +206,9 @@ public static class ContentRepositoryExtensions { foreach (IPropertyValue pvalue in otherProperty.Values) { - if (otherProperty.PropertyType.SupportsVariation(pvalue.Culture, pvalue.Segment, true) && - (culture == "*" || (pvalue.Culture?.InvariantEquals(culture) ?? false))) + if (((otherProperty?.PropertyType.SupportsVariation(pvalue.Culture, pvalue.Segment, true) ?? false) && + (culture == "*" ||(pvalue.Culture?.InvariantEquals(culture) ?? false))) || + otherProperty?.PropertyType?.Variations == ContentVariation.Nothing) { var value = published ? pvalue.PublishedValue : pvalue.EditedValue; content.SetValue(alias, value, pvalue.Culture, pvalue.Segment); From fdea8c28c89c62bf33272e67b3d7770ff2becf9f Mon Sep 17 00:00:00 2001 From: Ethan Nagano <50598649+nagolucky18@users.noreply.github.com> Date: Tue, 26 Mar 2024 02:39:34 -0700 Subject: [PATCH 2/5] 14744 tour not coded to best practice (#15133) * Apply focusLockService to TourStepDirective Apply focusLockService to TourStepDirective in order to ensure that non-modal page contents are inert and do not interfere with focus on modal dialog with regards to screen reading technologies. * Add properties to umb-tour.html. Add properties to umb-tour html page to ensure that it aligns with modal dialog best practices. * Add dialog properties to Umbraco tour .html files. Add properties relating to dialog and accessibility to the Umbraco tour .html files, including aria-label, role, and tab index. --- .../components/application/umbtour/umbtourstep.directive.js | 6 ++++-- .../src/views/components/application/umb-tour.html | 6 +++--- .../application/umbtour/umb-tour-step-content.html | 4 ++-- .../application/umbtour/umb-tour-step-counter.html | 2 +- .../application/umbtour/umb-tour-step-header.html | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour/umbtourstep.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour/umbtourstep.directive.js index 381ecc76c3..53ff989c7d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour/umbtourstep.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour/umbtourstep.directive.js @@ -14,16 +14,18 @@ (function () { 'use strict'; - function TourStepDirective() { + function TourStepDirective(focusLockService) { function link(scope, element, attrs, ctrl) { scope.close = function () { if (scope.onClose) { - scope.onClose(); + scope.onClose(); + focusLockService.removeInertAttribute(); } } + focusLockService.addInertAttribute(); } var directive = { diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-tour.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-tour.html index 064dcf6945..76baebc645 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-tour.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-tour.html @@ -1,4 +1,4 @@ -
+ @@ -58,7 +58,7 @@ - + diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-content.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-content.html index 0010a2bc6d..225e93bd86 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-content.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-content.html @@ -1,4 +1,4 @@
-
+
-
\ No newline at end of file +
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-counter.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-counter.html index bd4e0127d2..3a3fed00b4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-counter.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-counter.html @@ -1 +1 @@ -
{{ currentStep }}/{{ totalSteps }}
\ No newline at end of file +
{{ currentStep }}/{{ totalSteps }}
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-header.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-header.html index e34aa2025c..f4cdf0bdbd 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-header.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umbtour/umb-tour-step-header.html @@ -1,4 +1,4 @@
-
{{title}}
+
{{title}}
-
\ No newline at end of file + From d765e69713cebae48a234ea69d9633bd7564c36d Mon Sep 17 00:00:00 2001 From: Mole Date: Tue, 2 Apr 2024 08:31:38 +0200 Subject: [PATCH 3/5] V13: Align database schemas of migrated and new database (#15934) * Drop default constraint umbracoCacheInstruction table * Align umbracoContentVersion table * Update indexes on external login table * Align node table * Make relation type index unique * Remove user-group default constraint * Re-order methods * Make webhook url not nullable * Cleanup * Cleanup --- .../Migrations/Upgrade/UmbracoPlan.cs | 1 + .../Upgrade/V_13_3_0/AlignUpgradedDatabase.cs | 181 ++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 src/Umbraco.Infrastructure/Migrations/Upgrade/V_13_3_0/AlignUpgradedDatabase.cs diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs index 3503a85b57..3ba30b12df 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs @@ -105,5 +105,6 @@ public class UmbracoPlan : MigrationPlan To("{F74CDA0C-7AAA-48C8-94C6-C6EC3C06F599}"); To("{21C42760-5109-4C03-AB4F-7EA53577D1F5}"); To("{6158F3A3-4902-4201-835E-1ED7F810B2D8}"); + To("{985AF2BA-69D3-4DBA-95E0-AD3FA7459FA7}"); } } diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_13_3_0/AlignUpgradedDatabase.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_13_3_0/AlignUpgradedDatabase.cs new file mode 100644 index 0000000000..84171e8717 --- /dev/null +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_13_3_0/AlignUpgradedDatabase.cs @@ -0,0 +1,181 @@ +using NPoco; +using Umbraco.Cms.Infrastructure.Persistence; +using Umbraco.Cms.Infrastructure.Persistence.Dtos; +using ColumnInfo = Umbraco.Cms.Infrastructure.Persistence.SqlSyntax.ColumnInfo; + +namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_13_3_0; + +/// +/// We see some differences between an updated database and a fresh one, +/// the purpose of this migration is to align the two. +/// +public class AlignUpgradedDatabase : MigrationBase +{ + public AlignUpgradedDatabase(IMigrationContext context) + : base(context) + { + } + + protected override void Migrate() + { + // We ignore SQLite since it's considered a development DB + if (DatabaseType == DatabaseType.SQLite) + { + return; + } + + ColumnInfo[] columns = SqlSyntax.GetColumnsInSchema(Context.Database).ToArray(); + Tuple[] indexes = SqlSyntax.GetDefinedIndexes(Database).ToArray(); + + DropCacheInstructionDefaultConstraint(columns); + AlignContentVersionTable(columns); + UpdateExternalLoginIndexes(indexes); + AlignNodeTable(columns); + MakeRelationTypeIndexUnique(indexes); + RemoveUserGroupDefault(columns); + MakeWebhookUrlNotNullable(columns); + MakeWebhookLogUrlNotNullable(columns); + } + + private void MakeIndexUnique(string tableName, string indexName, IEnumerable> indexes) + { + // Let's only mess with the indexes if we have to. + // Indexes are in format TableName, IndexName, ColumnName, IsUnique + Tuple? loginProviderIndex = indexes.FirstOrDefault(x => + x.Item1 == tableName && x.Item2 == indexName); + + // Item4 == IsUnique + if (loginProviderIndex?.Item4 is false) + { + // The recommended way to change an index from non-unique to unique is to drop and recreate it. + DeleteIndex(indexName); + CreateIndex(indexName); + } + } + + private void RemoveDefaultConstraint(string tableName, string columnName, IEnumerable columns) + { + ColumnInfo? targetColumn = columns + .FirstOrDefault(x => x.TableName == tableName && x.ColumnName == columnName); + + if (targetColumn is null) + { + throw new InvalidOperationException($"Could not find {columnName} column on {tableName} table."); + } + + if (targetColumn.ColumnDefault is null) + { + return; + } + + Delete.DefaultConstraint() + .OnTable(tableName) + .OnColumn(columnName) + .Do(); + } + + private void RenameColumn(string tableName, string oldColumnName, string newColumnName, IEnumerable columns) + { + ColumnInfo? targetColumn = columns + .FirstOrDefault(x => x.TableName == tableName && x.ColumnName == oldColumnName); + + if (targetColumn is null) + { + // The column was not found I.E. the column is correctly named + return; + } + + Rename.Column(oldColumnName) + .OnTable(tableName) + .To(newColumnName) + .Do(); + } + + private void MakeNvarCharColumnNotNullable(string tableName, string columnName, IEnumerable columns) + { + ColumnInfo? targetColumn = columns.FirstOrDefault(x => x.TableName == tableName && x.ColumnName == columnName); + + if (targetColumn is null) + { + throw new InvalidOperationException($"Could not find {columnName} column in {tableName} table."); + } + + if (targetColumn.IsNullable is false) + { + return; + } + + Alter.Table(tableName) + .AlterColumn(columnName) + .AsCustom("nvarchar(max)") + .NotNullable() + .Do(); + } + + private void DropCacheInstructionDefaultConstraint(IEnumerable columns) + => RemoveDefaultConstraint("umbracoCacheInstruction", "jsonInstruction", columns); + + private void AlignContentVersionTable(ColumnInfo[] columns) + { + // We need to do this to ensure we don't try to rename the constraint if it doesn't exist. + const string tableName = "umbracoContentVersion"; + const string columnName = "VersionDate"; + ColumnInfo? versionDateColumn = columns + .FirstOrDefault(x => x is { TableName: tableName, ColumnName: columnName }); + + if (versionDateColumn is null) + { + // The column was not found I.E. the column is correctly named + return; + } + + RenameColumn(tableName, columnName, "versionDate", columns); + + // Renames the default constraint for the column, + // apparently the content version table used to be prefixed with cms and not umbraco + // We don't have a fluid way to rename the default constraint so we have to use raw SQL + // This should be okay though since we are only running this migration on SQL Server + Sql renameConstraintQuery = Database.SqlContext.Sql( + "EXEC sp_rename N'DF_cmsContentVersion_VersionDate', N'DF_umbracoContentVersion_versionDate', N'OBJECT'"); + Database.Execute(renameConstraintQuery); + } + + private void UpdateExternalLoginIndexes(IEnumerable> indexes) + { + const string userMemberOrKeyIndexName = "IX_umbracoExternalLogin_userOrMemberKey"; + + MakeIndexUnique("umbracoExternalLogin", "IX_umbracoExternalLogin_LoginProvider", indexes); + + if (IndexExists(userMemberOrKeyIndexName)) + { + return; + } + + CreateIndex(userMemberOrKeyIndexName); + } + + private void AlignNodeTable(ColumnInfo[] columns) + { + const string tableName = "umbracoNode"; + RenameColumn(tableName, "parentID", "parentId", columns); + RenameColumn(tableName, "uniqueID", "uniqueId", columns); + + const string extraIndexName = "IX_umbracoNode_ParentId"; + if (IndexExists(extraIndexName)) + { + DeleteIndex(extraIndexName); + } + } + + private void MakeRelationTypeIndexUnique(Tuple[] indexes) + => MakeIndexUnique("umbracoRelationType", "IX_umbracoRelationType_alias", indexes); + + private void RemoveUserGroupDefault(ColumnInfo[] columns) + => RemoveDefaultConstraint("umbracoUserGroup", "hasAccessToAllLanguages", columns); + + private void MakeWebhookUrlNotNullable(ColumnInfo[] columns) + => MakeNvarCharColumnNotNullable("umbracoWebhook", "url", columns); + + private void MakeWebhookLogUrlNotNullable(ColumnInfo[] columns) + => MakeNvarCharColumnNotNullable("umbracoWebhookLog", "url", columns); +} From 682b7656bc06534246b707e20794574afe3957f3 Mon Sep 17 00:00:00 2001 From: Chad Date: Mon, 25 Mar 2024 17:35:19 +1300 Subject: [PATCH 4/5] Update RefreshMethodType.cs --- src/Umbraco.Core/Sync/RefreshMethodType.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Core/Sync/RefreshMethodType.cs b/src/Umbraco.Core/Sync/RefreshMethodType.cs index f249a4701e..11de3a627f 100644 --- a/src/Umbraco.Core/Sync/RefreshMethodType.cs +++ b/src/Umbraco.Core/Sync/RefreshMethodType.cs @@ -10,12 +10,12 @@ public enum RefreshMethodType // that enum should get merged somehow with MessageType and renamed somehow // but at the moment it is exposed in CacheRefresher webservice through RefreshInstruction // so for the time being we keep it as-is for backward compatibility reasons - RefreshAll, - RefreshByGuid, - RefreshById, - RefreshByIds, - RefreshByJson, - RemoveById, + RefreshAll = 0, + RefreshByGuid = 1, + RefreshById = 2, + RefreshByIds = 3, + RefreshByJson = 4, + RemoveById = 5, // would adding values break backward compatibility? // RemoveByIds From 71e16d20ef7911bb148563fa6067ab323ef4cba5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:01:43 +0000 Subject: [PATCH 5/5] Bump vite from 5.1.1 to 5.1.7 in /src/Umbraco.Web.UI.Login Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.1.1 to 5.1.7. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v5.1.7/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v5.1.7/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- src/Umbraco.Web.UI.Login/package-lock.json | 8 ++++---- src/Umbraco.Web.UI.Login/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Login/package-lock.json b/src/Umbraco.Web.UI.Login/package-lock.json index 50e4e585ce..b4524339e1 100644 --- a/src/Umbraco.Web.UI.Login/package-lock.json +++ b/src/Umbraco.Web.UI.Login/package-lock.json @@ -14,7 +14,7 @@ "@umbraco-ui/uui": "1.7.1", "@umbraco-ui/uui-css": "1.7.0", "typescript": "^5.3.3", - "vite": "^5.1.1" + "vite": "^5.1.7" }, "engines": { "node": ">=20.8", @@ -2176,9 +2176,9 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/vite": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.1.tgz", - "integrity": "sha512-wclpAgY3F1tR7t9LL5CcHC41YPkQIpKUGeIuT8MdNwNZr6OqOTLs7JX5vIHAtzqLWXts0T+GDrh9pN2arneKqg==", + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.7.tgz", + "integrity": "sha512-sgnEEFTZYMui/sTlH1/XEnVNHMujOahPLGMxn1+5sIT45Xjng1Ec1K78jRP15dSmVgg5WBin9yO81j3o9OxofA==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/src/Umbraco.Web.UI.Login/package.json b/src/Umbraco.Web.UI.Login/package.json index d461e761f6..90e3bf68cb 100644 --- a/src/Umbraco.Web.UI.Login/package.json +++ b/src/Umbraco.Web.UI.Login/package.json @@ -21,7 +21,7 @@ "@umbraco-ui/uui": "1.7.1", "@umbraco-ui/uui-css": "1.7.0", "typescript": "^5.3.3", - "vite": "^5.1.1" + "vite": "^5.1.7" }, "msw": { "workerDirectory": "public"