Search Results for

    Show / Hide Table of Contents
    View Source

    Class NotificationService

    Provides functionality for managing and sending notifications to users when content is modified.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public class NotificationService : INotificationService, IService

    Constructors

    View Source

    NotificationService(ICoreScopeProvider, IUserService, IContentService, ILocalizationService, ILogger<NotificationService>, IIOHelper, INotificationsRepository, IOptions<GlobalSettings>, IOptions<ContentSettings>, IEmailSender)

    Initializes a new instance of the NotificationService class.

    Declaration
    public NotificationService(ICoreScopeProvider provider, IUserService userService, IContentService contentService, ILocalizationService localizationService, ILogger<NotificationService> logger, IIOHelper ioHelper, INotificationsRepository notificationsRepository, IOptions<GlobalSettings> globalSettings, IOptions<ContentSettings> contentSettings, IEmailSender emailSender)
    Parameters
    Type Name Description
    ICoreScopeProvider provider

    The scope provider for unit of work operations.

    IUserService userService

    The user service for retrieving user information.

    IContentService contentService

    The content service for accessing content versions.

    ILocalizationService localizationService

    The localization service for language operations.

    ILogger<NotificationService> logger

    The logger for diagnostic output.

    IIOHelper ioHelper

    The IO helper for resolving paths.

    INotificationsRepository notificationsRepository

    The repository for notification data access.

    IOptions<GlobalSettings> globalSettings

    The global settings options.

    IOptions<ContentSettings> contentSettings

    The content settings options.

    IEmailSender emailSender

    The email sender for delivering notifications.

    Methods

    View Source

    DeleteNotifications(IEntity)

    Deletes notifications by entity

    Declaration
    public void DeleteNotifications(IEntity entity)
    Parameters
    Type Name Description
    IEntity entity
    View Source

    DeleteNotifications(IUser)

    Deletes notifications by user

    Declaration
    public void DeleteNotifications(IUser user)
    Parameters
    Type Name Description
    IUser user
    View Source

    DeleteNotifications(IUser, IEntity)

    Delete notifications by user and entity

    Declaration
    public void DeleteNotifications(IUser user, IEntity entity)
    Parameters
    Type Name Description
    IUser user
    IEntity entity
    View Source

    FilterUserNotificationsByPath(IEnumerable<Notification>?, string)

    Filters a userNotifications collection by a path

    Declaration
    public IEnumerable<Notification>? FilterUserNotificationsByPath(IEnumerable<Notification>? userNotifications, string path)
    Parameters
    Type Name Description
    IEnumerable<Notification> userNotifications
    string path
    Returns
    Type Description
    IEnumerable<Notification>
    View Source

    GetEntityNotifications(IEntity)

    Deletes notifications by entity

    Declaration
    public IEnumerable<Notification>? GetEntityNotifications(IEntity entity)
    Parameters
    Type Name Description
    IEntity entity
    Returns
    Type Description
    IEnumerable<Notification>
    View Source

    GetUserNotifications(IUser)

    Gets the notifications for the user

    Declaration
    public IEnumerable<Notification>? GetUserNotifications(IUser user)
    Parameters
    Type Name Description
    IUser user
    Returns
    Type Description
    IEnumerable<Notification>
    View Source

    GetUserNotifications(IUser?, string)

    Gets the notifications for the user based on the specified node path

    Declaration
    public IEnumerable<Notification>? GetUserNotifications(IUser? user, string path)
    Parameters
    Type Name Description
    IUser user
    string path
    Returns
    Type Description
    IEnumerable<Notification>
    Remarks

    Notifications are inherited from the parent so any child node will also have notifications assigned based on it's parent (ancestors)

    View Source

    SendNotifications(IUser, IEnumerable<IContent>, string?, string?, Uri, Func<(IUser user, NotificationEmailSubjectParams subject), string>, Func<(IUser user, NotificationEmailBodyParams body, bool isHtml), string>)

    Sends the notifications for the specified user regarding the specified node and action.

    Declaration
    public void SendNotifications(IUser operatingUser, IEnumerable<IContent> entities, string? action, string? actionName, Uri siteUri, Func<(IUser user, NotificationEmailSubjectParams subject), string> createSubject, Func<(IUser user, NotificationEmailBodyParams body, bool isHtml), string> createBody)
    Parameters
    Type Name Description
    IUser operatingUser
    IEnumerable<IContent> entities
    string action
    string actionName
    Uri siteUri
    Func<(IUser user, NotificationEmailSubjectParams subject), string> createSubject
    Func<(IUser user, NotificationEmailBodyParams body, bool isHtml), string> createBody
    View Source

    SetNotifications(IUser?, IEntity, string[])

    Sets the specific notifications for the user and entity

    Declaration
    public IEnumerable<Notification>? SetNotifications(IUser? user, IEntity entity, string[] actions)
    Parameters
    Type Name Description
    IUser user
    IEntity entity
    string[] actions
    Returns
    Type Description
    IEnumerable<Notification>
    Remarks

    This performs a full replace

    View Source

    TryCreateNotification(IUser, IEntity, string, out Notification?)

    Tries to create a new notification.

    Declaration
    public bool TryCreateNotification(IUser user, IEntity entity, string action, out Notification? notification)
    Parameters
    Type Name Description
    IUser user

    The user.

    IEntity entity

    The entity.

    string action

    The action letter - note: this is a string for future compatibility

    Notification notification

    The created notification.

    Returns
    Type Description
    bool
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX