Merge pull request #2610 from ProNotion/issues/U4-11296
Fixes U4-11296 allowing nulls to be stored in the comment column of the umbracoConsent table
This commit is contained in:
@@ -39,6 +39,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public int State { get; set; }
|
||||
|
||||
[Column("comment")]
|
||||
[NullSetting(NullSetting = NullSettings.Null)]
|
||||
public string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwelveZero
|
||||
{
|
||||
[Migration("7.12.0", 1, Constants.System.UmbracoMigrationName)]
|
||||
public class UpdateUmbracoConsent : MigrationBase
|
||||
{
|
||||
public UpdateUmbracoConsent(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
: base(sqlSyntax, logger)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Up()
|
||||
{
|
||||
this.Alter.Table("umbracoConsent").AlterColumn("comment").AsString().Nullable();
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
// We can't remove this in case we already have null values saved in the column
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -635,6 +635,7 @@
|
||||
<Compile Include="Media\Exif\TIFFStrip.cs" />
|
||||
<Compile Include="Media\Exif\Utility.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenThreeOne\UpdateUserLanguagesToIsoCode.cs" />
|
||||
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenTwelveZero\UpdateUmbracoConsent.cs" />
|
||||
<Compile Include="Persistence\PocoDataDataReader.cs" />
|
||||
<Compile Include="Persistence\Querying\CachedExpression.cs" />
|
||||
<Compile Include="Persistence\Querying\QueryExtensions.cs" />
|
||||
@@ -1673,6 +1674,7 @@
|
||||
<LastGenOutput>Files.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets" Condition="Exists('..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -121,5 +121,20 @@ namespace Umbraco.Tests.Services
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
consentService.RegisterConsent("user/1234", "app1", "do-something", ConsentState.Granted | ConsentState.Revoked, "no comment"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanRegisterConsentWithoutComment()
|
||||
{
|
||||
var consentService = ServiceContext.ConsentService;
|
||||
|
||||
// Attept to add consent without a comment
|
||||
consentService.RegisterConsent("user/1234", "app1", "consentWithoutComment", ConsentState.Granted);
|
||||
|
||||
// Attempt to retrieve the consent we just added without a comment
|
||||
var consents = consentService.LookupConsent(source: "user/1234", action: "consentWithoutComment").ToArray();
|
||||
|
||||
// Confirm we got our expected consent record
|
||||
Assert.AreEqual(1, consents.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,37 +140,7 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
|
||||
//Filter the path for root node ids (we don't want to pass in -1 or 'init')
|
||||
|
||||
args.path = _.filter(args.path, function (item) { return (item !== "init" && item !== "-1"); });
|
||||
|
||||
//Once those are filtered we need to check if the current user has a special start node id,
|
||||
// if they do, then we're going to trim the start of the array for anything found from that start node
|
||||
// and previous so that the tree syncs properly. The tree syncs from the top down and if there are parts
|
||||
// of the tree's path in there that don't actually exist in the dom/model then syncing will not work.
|
||||
|
||||
userService.getCurrentUser().then(function (userData) {
|
||||
|
||||
var startNodes = [];
|
||||
for (var i = 0; i < userData.startContentIds; i++) {
|
||||
startNodes.push(userData.startContentIds[i]);
|
||||
}
|
||||
for (var j = 0; j < userData.startMediaIds; j++) {
|
||||
startNodes.push(userData.startMediaIds[j]);
|
||||
}
|
||||
|
||||
_.each(startNodes, function (i) {
|
||||
var found = _.find(args.path, function (p) {
|
||||
return String(p) === String(i);
|
||||
});
|
||||
if (found) {
|
||||
args.path = args.path.splice(_.indexOf(args.path, found));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
loadPath(args.path, args.forceReload, args.activate);
|
||||
|
||||
});
|
||||
|
||||
|
||||
loadPath(args.path, args.forceReload, args.activate);
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user