Remove obsolete static events

This commit is contained in:
Mole
2021-03-29 10:42:42 +02:00
parent c113ca8eda
commit b4cbf0cf5d
7 changed files with 55 additions and 104 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
@@ -796,7 +796,6 @@ namespace Umbraco.Cms.Core.Services.Implement
if (raiseEvents)
{
scope.Notifications.Publish(new MemberSavedNotification(member, evtMsgs).WithStateFrom(savingNotification));
scope.Events.Dispatch(Saved, this, new SaveEventArgs<IMember>(member, false));
}
Audit(AuditType.Save, 0, member.Id);
@@ -835,7 +834,6 @@ namespace Umbraco.Cms.Core.Services.Implement
if (raiseEvents)
{
scope.Notifications.Publish(new MemberSavedNotification(membersA, evtMsgs).WithStateFrom(savingNotification));
scope.Events.Dispatch(Saved, this, new SaveEventArgs<IMember>(membersA, false));
}
Audit(AuditType.Save, 0, -1, "Save multiple Members");
@@ -877,7 +875,6 @@ namespace Umbraco.Cms.Core.Services.Implement
// a member has no descendants
_memberRepository.Delete(member);
scope.Notifications.Publish(new MemberDeletedNotification(member, evtMsgs).WithState(notificationState));
scope.Events.Dispatch(Deleted, this, new DeleteEventArgs<IMember>(member, false));
// media files deleted by QueuingEventDispatcher
}
@@ -1073,16 +1070,6 @@ namespace Umbraco.Cms.Core.Services.Implement
#endregion
#region Event Handlers
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for MemberDeletedNotification instead.")]
public static event TypedEventHandler<IMemberService, DeleteEventArgs<IMember>> Deleted;
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for MemberSavedNotification instead.")]
public static event TypedEventHandler<IMemberService, SaveEventArgs<IMember>> Saved;
#endregion
#region Membership

View File

@@ -11,7 +11,7 @@ using Umbraco.Extensions;
namespace Umbraco.Cms.Core.Services.Implement
{
public class PublicAccessService : RepositoryService, IPublicAccessService
internal class PublicAccessService : RepositoryService, IPublicAccessService
{
private readonly IPublicAccessRepository _publicAccessRepository;
@@ -115,7 +115,7 @@ namespace Umbraco.Cms.Core.Services.Implement
{
entry = _publicAccessRepository.GetMany().FirstOrDefault(x => x.ProtectedNodeId == content.Id);
if (entry == null)
return OperationResult.Attempt.Cannot<PublicAccessEntry>(evtMsgs); // causes rollback // causes rollback
return OperationResult.Attempt.Cannot<PublicAccessEntry>(evtMsgs); // causes rollback
var existingRule = entry.Rules.FirstOrDefault(x => x.RuleType == ruleType && x.RuleValue == ruleValue);
if (existingRule == null)
@@ -140,7 +140,6 @@ namespace Umbraco.Cms.Core.Services.Implement
scope.Complete();
scope.Notifications.Publish(new PublicAccessEntrySavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation));
scope.Events.Dispatch(Saved, this, new SaveEventArgs<PublicAccessEntry>(entry, false));
}
return OperationResult.Attempt.Succeed(evtMsgs, entry);
@@ -177,7 +176,6 @@ namespace Umbraco.Cms.Core.Services.Implement
scope.Complete();
scope.Notifications.Publish(new PublicAccessEntrySavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation));
scope.Events.Dispatch(Saved, this, new SaveEventArgs<PublicAccessEntry>(entry, false));
}
return OperationResult.Attempt.Succeed(evtMsgs);
@@ -204,7 +202,6 @@ namespace Umbraco.Cms.Core.Services.Implement
scope.Complete();
scope.Notifications.Publish(new PublicAccessEntrySavedNotification(entry, evtMsgs).WithStateFrom(savingNotifiation));
scope.Events.Dispatch(Saved, this, new SaveEventArgs<PublicAccessEntry>(entry, false));
}
return OperationResult.Attempt.Succeed(evtMsgs);
@@ -231,16 +228,9 @@ namespace Umbraco.Cms.Core.Services.Implement
scope.Complete();
scope.Notifications.Publish(new PublicAccessEntryDeletedNotification(entry, evtMsgs).WithStateFrom(deletingNotification));
scope.Events.Dispatch(Deleted, this, new DeleteEventArgs<PublicAccessEntry>(entry, false));
}
return OperationResult.Attempt.Succeed(evtMsgs);
}
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for PublicAccessEntrySavedNotification instead.")]
public static event TypedEventHandler<IPublicAccessService, SaveEventArgs<PublicAccessEntry>> Saved;
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for PublicAccessEntryDeletedNotification instead.")]
public static event TypedEventHandler<IPublicAccessService, DeleteEventArgs<PublicAccessEntry>> Deleted;
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Globalization;
@@ -22,7 +22,7 @@ namespace Umbraco.Cms.Core.Services.Implement
/// <summary>
/// Represents the UserService, which is an easy access to operations involving <see cref="IProfile"/>, <see cref="IMembershipUser"/> and eventually Backoffice Users.
/// </summary>
public class UserService : RepositoryService, IUserService
internal class UserService : RepositoryService, IUserService
{
private readonly IUserRepository _userRepository;
private readonly IUserGroupRepository _userGroupRepository;
@@ -142,7 +142,6 @@ namespace Umbraco.Cms.Core.Services.Implement
_userRepository.Save(user);
scope.Notifications.Publish(new UserSavedNotification(user, evtMsgs).WithStateFrom(savingNotification));
scope.Events.Dispatch(SavedUser, this, new SaveEventArgs<IUser>(user, false));
scope.Complete();
}
@@ -256,7 +255,6 @@ namespace Umbraco.Cms.Core.Services.Implement
_userRepository.Delete(user);
scope.Notifications.Publish(new UserDeletedNotification(user, evtMsgs).WithStateFrom(deletingNotification));
scope.Events.Dispatch(DeletedUser, this, new DeleteEventArgs<IUser>(user, false));
scope.Complete();
}
}
@@ -300,7 +298,6 @@ namespace Umbraco.Cms.Core.Services.Implement
if (raiseEvents)
{
scope.Notifications.Publish(new UserSavedNotification(entity, evtMsgs).WithStateFrom(savingNotification));
scope.Events.Dispatch(SavedUser, this, new SaveEventArgs<IUser>(entity, false));
}
scope.Complete();
@@ -354,7 +351,6 @@ namespace Umbraco.Cms.Core.Services.Implement
if (raiseEvents)
{
scope.Notifications.Publish(new UserSavedNotification(entitiesA, evtMsgs).WithStateFrom(savingNotification));
scope.Events.Dispatch(SavedUser, this, new SaveEventArgs<IUser>(entitiesA, false));
}
//commit the whole lot in one go
@@ -865,7 +861,6 @@ namespace Umbraco.Cms.Core.Services.Implement
{
scope.Notifications.Publish(new UserGroupSavedNotification(userGroup, evtMsgs).WithStateFrom(savingNotification));
scope.Notifications.Publish(new UserGroupWithUsersSavedNotification(userGroupWithUsers, evtMsgs).WithStateFrom(savingUserGroupWithUsersNotification));
scope.Events.Dispatch(SavedUserGroup, this, new SaveEventArgs<UserGroupWithUsers>(new UserGroupWithUsers(userGroup, addedUsers, removedUsers), false));
}
scope.Complete();
@@ -892,7 +887,6 @@ namespace Umbraco.Cms.Core.Services.Implement
_userGroupRepository.Delete(userGroup);
scope.Notifications.Publish(new UserGroupDeletedNotification(userGroup, evtMsgs).WithStateFrom(deletingNotification));
scope.Events.Dispatch(DeletedUserGroup, this, new DeleteEventArgs<IUserGroup>(userGroup, false));
scope.Complete();
}
@@ -1172,17 +1166,5 @@ namespace Umbraco.Cms.Core.Services.Implement
}
#endregion
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for UserSavedNotification instead.")]
public static event TypedEventHandler<IUserService, SaveEventArgs<IUser>> SavedUser;
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for UserDeletedNotification instead.")]
public static event TypedEventHandler<IUserService, DeleteEventArgs<IUser>> DeletedUser;
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for UserGroupSavedNotification instead.")]
public static event TypedEventHandler<IUserService, SaveEventArgs<UserGroupWithUsers>> SavedUserGroup;
[Obsolete("Will be removed in an upcoming version. Implement an INotificationHandler for UserGroupDeletedNotification instead.")]
public static event TypedEventHandler<IUserService, DeleteEventArgs<IUserGroup>> DeletedUserGroup;
}
}