Make CreateTemplateForContentType non nullable and default to false.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user