< Summary - Jellyfin

Information
Class: Jellyfin.Server.Implementations.Events.Consumers.Users.UserUpdatedNotifier
Assembly: Jellyfin.Server.Implementations
File(s): /srv/git/jellyfin/Jellyfin.Server.Implementations/Events/Consumers/Users/UserUpdatedNotifier.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 42
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Server.Implementations/Events/Consumers/Users/UserUpdatedNotifier.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Threading;
 4using System.Threading.Tasks;
 5using Jellyfin.Data.Events.Users;
 6using MediaBrowser.Controller.Events;
 7using MediaBrowser.Controller.Library;
 8using MediaBrowser.Controller.Session;
 9using MediaBrowser.Model.Session;
 10
 11namespace Jellyfin.Server.Implementations.Events.Consumers.Users
 12{
 13    /// <summary>
 14    /// Notifies a user when their account has been updated.
 15    /// </summary>
 16    public class UserUpdatedNotifier : IEventConsumer<UserUpdatedEventArgs>
 17    {
 18        private readonly IUserManager _userManager;
 19        private readonly ISessionManager _sessionManager;
 20
 21        /// <summary>
 22        /// Initializes a new instance of the <see cref="UserUpdatedNotifier"/> class.
 23        /// </summary>
 24        /// <param name="userManager">The user manager.</param>
 25        /// <param name="sessionManager">The session manager.</param>
 26        public UserUpdatedNotifier(IUserManager userManager, ISessionManager sessionManager)
 27        {
 028            _userManager = userManager;
 029            _sessionManager = sessionManager;
 030        }
 31
 32        /// <inheritdoc />
 33        public async Task OnEvent(UserUpdatedEventArgs eventArgs)
 34        {
 35            await _sessionManager.SendMessageToUserSessions(
 36                new List<Guid> { eventArgs.Argument.Id },
 37                SessionMessageType.UserUpdated,
 38                _userManager.GetUserDto(eventArgs.Argument),
 39                CancellationToken.None).ConfigureAwait(false);
 40        }
 41    }
 42}