Make CreateTemplateForContentType non nullable and default to false.

This commit is contained in:
Mole
2021-04-09 09:59:53 +02:00
parent 7405191e03
commit b4f9dc7b66
3 changed files with 17 additions and 5 deletions

View File

@@ -20,12 +20,18 @@ namespace Umbraco.Cms.Infrastructure.Services.Notifications
{
}
public bool? CreateTemplateForContentType
public bool CreateTemplateForContentType
{
get
{
State.TryGetValue(s_templateForContentTypeKey, out var result);
return result as bool?;
if (result is not bool createTemplate)
{
return false;
}
return createTemplate;
}
set => State[s_templateForContentTypeKey] = value;
}

View File

@@ -35,12 +35,18 @@ namespace Umbraco.Cms.Infrastructure.Services.Notifications
ContentTypeAlias = contentTypeAlias;
}
public bool? CreateTemplateForContentType
public bool CreateTemplateForContentType
{
get
{
State.TryGetValue(s_templateForContentTypeKey, out var result);
return result as bool?;
if (result is not bool createTemplate)
{
return false;
}
return createTemplate;
}
set => State[s_templateForContentTypeKey] = value;
}

View File

@@ -98,7 +98,7 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder
}
// Don't do anything if we're not requested to create a template for a content type
if (notification.CreateTemplateForContentType is null or false)
if (notification.CreateTemplateForContentType is false)
{
return;
}