Merge branch 'issues/U4-11296' of https://github.com/ProNotion/Umbraco-CMS into ProNotion-issues/U4-11296
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.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
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user