Obsolete CreatorName and WriterName on IPublishedContent
This commit is contained in:
@@ -63,6 +63,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
/// <summary>
|
||||
/// Gets the name of the user who created the content item.
|
||||
/// </summary>
|
||||
[Obsolete("Use CreatorName(IUserService) extension instead")]
|
||||
string CreatorName { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -78,6 +79,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
/// <summary>
|
||||
/// Gets the name of the user who last updated the content item.
|
||||
/// </summary>
|
||||
[Obsolete("Use WriterName(IUserService) extension instead")]
|
||||
string WriterName { get; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -248,8 +248,10 @@ namespace Umbraco.Web.Macros
|
||||
|
||||
public string UrlSegment => throw new NotImplementedException();
|
||||
|
||||
[Obsolete("Use WriterName(IUserService) extension instead")]
|
||||
public string WriterName { get; }
|
||||
|
||||
[Obsolete("Use CreatorName(IUserService) extension instead")]
|
||||
public string CreatorName { get; }
|
||||
|
||||
public int WriterId => _inner.WriterId;
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace Umbraco.Web.Models
|
||||
public abstract int CreatorId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Use CreatorName(IUserService) extension instead")]
|
||||
|
||||
public abstract string CreatorName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -63,6 +65,8 @@ namespace Umbraco.Web.Models
|
||||
public abstract int WriterId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Use WriterName(IUserService) extension instead")]
|
||||
|
||||
public abstract string WriterName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -163,6 +163,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
public override int CreatorId => _contentNode.CreatorId;
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Use CreatorName(IUserService) extension instead")]
|
||||
|
||||
public override string CreatorName => GetProfileNameById(_contentNode.CreatorId);
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -172,6 +174,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
public override int WriterId => ContentData.WriterId;
|
||||
|
||||
/// <inheritdoc />
|
||||
[Obsolete("Use WriterName(IUserService) extension instead")]
|
||||
|
||||
public override string WriterName => GetProfileNameById(ContentData.WriterId);
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -140,9 +140,13 @@ namespace Umbraco.Web.PublishedCache
|
||||
public override string UrlSegment => throw new NotSupportedException();
|
||||
|
||||
// TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current
|
||||
[Obsolete("Use WriterName(IUserService) extension instead")]
|
||||
|
||||
public override string WriterName => _member.GetCreatorProfile().Name;
|
||||
|
||||
// TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current
|
||||
[Obsolete("Use CreatorName(IUserService) extension instead")]
|
||||
|
||||
public override string CreatorName => _member.GetCreatorProfile().Name;
|
||||
|
||||
public override int WriterId => _member.CreatorId;
|
||||
|
||||
@@ -28,6 +28,20 @@ namespace Umbraco.Web
|
||||
private static UmbracoContext UmbracoContext => Current.UmbracoContext;
|
||||
private static ISiteDomainHelper SiteDomainHelper => Current.Factory.GetInstance<ISiteDomainHelper>();
|
||||
|
||||
#region Creator/Writer Names
|
||||
|
||||
public static string CreatorName(this IPublishedContent content, IUserService userService)
|
||||
{
|
||||
return userService.GetProfileById(content.CreatorId)?.Name;
|
||||
}
|
||||
|
||||
public static string WriterName(this IPublishedContent content, IUserService userService)
|
||||
{
|
||||
return userService.GetProfileById(content.WriterId)?.Name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsComposedOf
|
||||
|
||||
/// <summary>
|
||||
@@ -1004,8 +1018,8 @@ namespace Umbraco.Web
|
||||
{ "NodeTypeAlias", n.ContentType.Alias },
|
||||
{ "CreateDate", n.CreateDate },
|
||||
{ "UpdateDate", n.UpdateDate },
|
||||
{ "CreatorName", n.CreatorName },
|
||||
{ "WriterName", n.WriterName },
|
||||
{ "CreatorName", n.CreatorName(services.UserService) },
|
||||
{ "WriterName", n.WriterName(services.UserService) },
|
||||
{ "Url", n.Url() }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user