diff --git a/src/Umbraco.Core/Models/Rdbms/ConsentDto.cs b/src/Umbraco.Core/Models/Rdbms/ConsentDto.cs index 0b6481070a..dc5fe44be3 100644 --- a/src/Umbraco.Core/Models/Rdbms/ConsentDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/ConsentDto.cs @@ -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; } } } diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenElevenZero/UpdateUmbracoConsent.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenElevenZero/UpdateUmbracoConsent.cs new file mode 100644 index 0000000000..a9aaac13a4 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenElevenZero/UpdateUmbracoConsent.cs @@ -0,0 +1,24 @@ +using Umbraco.Core.Logging; +using Umbraco.Core.Persistence.SqlSyntax; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenElevenZero +{ + [Migration("7.11.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 + } + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 5d070be719..a338416938 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -281,6 +281,8 @@ + + @@ -306,6 +308,10 @@ + + + + @@ -601,6 +607,7 @@ + @@ -1682,4 +1689,1687 @@ --> + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {31785BC3-256C-4613-B2F5-A1B0BDDED8C1} + Library + Properties + Umbraco.Core + Umbraco.Core + v4.5 + 512 + ..\ + true + + latest + + + true + full + false + bin\Debug\ + TRACE;DEBUG + prompt + 4 + false + latest + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + bin\Release\Umbraco.Core.xml + false + + + + ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll + + + ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll + + + ..\packages\ClientDependency.1.9.6\lib\net45\ClientDependency.Core.dll + + + ..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll + + + ..\packages\ImageProcessor.2.5.6\lib\net45\ImageProcessor.dll + + + ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll + + + ..\packages\Log4Net.Async.2.0.4\lib\net40\Log4Net.Async.dll + + + ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll + + + ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll + + + ..\packages\Microsoft.Owin.3.1.0\lib\net45\Microsoft.Owin.dll + + + ..\packages\Microsoft.Owin.Security.3.1.0\lib\net45\Microsoft.Owin.Security.dll + + + ..\packages\Microsoft.Owin.Security.Cookies.3.1.0\lib\net45\Microsoft.Owin.Security.Cookies.dll + + + ..\packages\Microsoft.Owin.Security.OAuth.3.1.0\lib\net45\Microsoft.Owin.Security.OAuth.dll + + + ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll + + + ..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll + True + + + ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + + + ..\packages\semver.1.1.2\lib\net45\Semver.dll + + + + + + + + ..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.dll + + + ..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll + + + + + + + + + + + + + ..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll + + + + + + False + + + + + + + + + + Properties\SolutionInfo.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Files.resx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Constants.cs + + + Constants.cs + + + Constants.cs + + + Constants.cs + + + Constants.cs + + + Constants.cs + + + Constants.cs + + + Constants.cs + + + Constants.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {511F6D8D-7717-440A-9A57-A507E9A8B27F} + umbraco.interfaces + + + + + ResXFileCodeGenerator + Files.Designer.cs + + + + + \ No newline at end of file diff --git a/src/Umbraco.Tests/Services/ConsentServiceTests.cs b/src/Umbraco.Tests/Services/ConsentServiceTests.cs index a39bb892d9..bc64171a74 100644 --- a/src/Umbraco.Tests/Services/ConsentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ConsentServiceTests.cs @@ -121,5 +121,20 @@ namespace Umbraco.Tests.Services Assert.Throws(() => 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); + } } }