public async Task UnregisterMemberFromNotifications(Project project, long userId) { var userIdentifier = new UserIdentifier(1, userId); var entityIdentifier = new EntityIdentifier(typeof(Project), project.Id); //Unsubscribe name await _notificationSubscriptionManager.UnsubscribeAsync(userIdentifier, TodoNotificationTypes.TodoNameEdited, entityIdentifier); //Unsubscribe name await _notificationSubscriptionManager.UnsubscribeAsync(userIdentifier, TodoNotificationTypes.TodoDateEdited, entityIdentifier); //Unsubscribe name await _notificationSubscriptionManager.UnsubscribeAsync(userIdentifier, TodoNotificationTypes.TodoDeleted, entityIdentifier); //Unsubscribe name await _notificationSubscriptionManager.UnsubscribeAsync(userIdentifier, TodoNotificationTypes.TodoChangeStatusForAllInProject, entityIdentifier); //Unsubscribe todoListNameChanged await _notificationSubscriptionManager.UnsubscribeAsync(userIdentifier, TodoNotificationTypes.TodoListNameChanged, entityIdentifier); }
public async Task UnSubscribeTenantToEditionChanges(Tenant tenant, Edition tenantPrevEdition, User tenantOwner) { var entityIdentifier = new EntityIdentifier(typeof(Edition), tenantPrevEdition.Id); var userIdentifier = new UserIdentifier(tenant.Id, tenantOwner.Id); await _notificationSubscriptionManager.UnsubscribeAsync(userIdentifier, NotificationNames.EditionEdited, entityIdentifier); await _notificationSubscriptionManager.UnsubscribeAsync(userIdentifier, NotificationNames.EditionDeleted, entityIdentifier); }
public async Task UpdateNotificationSettings(UpdateNotificationSettingsInput input) { await SettingManager.ChangeSettingForUserAsync(AbpSession.ToUserIdentifier(), NotificationSettingNames.ReceiveNotifications, input.ReceiveNotifications.ToString()); foreach (var notification in input.Notifications) { if (notification.IsSubscribed) { await _notificationSubscriptionManager.SubscribeAsync(AbpSession.ToUserIdentifier(), notification.Name); } else { await _notificationSubscriptionManager.UnsubscribeAsync(AbpSession.ToUserIdentifier(), notification.Name); } } }
public async Task UnSubscribeToAllNotifications(NotificationSubscriptionInput input) { await _notificationSubscriptionManager.UnsubscribeAsync(input.UserIdentifier, NotificationNames.UserDeleted); await _notificationSubscriptionManager.UnsubscribeAsync(input.UserIdentifier, NotificationNames.RoleAssigned); await _notificationSubscriptionManager.UnsubscribeAsync(input.UserIdentifier, NotificationNames.UserCreated); await _notificationSubscriptionManager.UnsubscribeAsync(input.UserIdentifier, NotificationNames.RoleCreated); await _notificationSubscriptionManager.UnsubscribeAsync(input.UserIdentifier, NotificationNames.RoleDeleted); }
public async Task RegisterToResponsibleNotifications(User user, Todo todo) { var notificationUserIdentity = new UserIdentifier(1, user.Id); var entityIdentity = new EntityIdentifier(typeof(Todo), todo.Id); if (todo.ResponsibleId.HasValue && user.Id != todo.ResponsibleId) { //If the todo has already a responsible //its diferent we unsubscribe the old responsible from the notifications await _notificationSubscriptionManager.UnsubscribeAsync( new UserIdentifier(1, (long)todo.ResponsibleId), TodoNotificationTypes.AddedAsResponsibleOfTask, entityIdentity); } //As responsible user must be register to his todo notifications await _notificationSubscriptionManager.SubscribeAsync( notificationUserIdentity, TodoNotificationTypes.AddedAsResponsibleOfTask, entityIdentity); }
/// <summary> /// 更新通知设置 /// </summary> public async Task UpdateNotificationSettings(UpdateNotificationSettingsInput input) { var currentUserId = AbpSession.ToUserIdentifier(); //是否接收通知 await SettingManager.ChangeSettingForUserAsync(currentUserId, NotificationSettingNames.ReceiveNotifications, input.ReceiveNotifications.ToString()); foreach (var notification in input.Notifications) { if (notification.IsSubscribed) { //订阅通知 await _notificationSubscriptionManager.SubscribeAsync(currentUserId, notification.Name); } else { //关闭通知订阅 await _notificationSubscriptionManager.UnsubscribeAsync(currentUserId, notification.Name); } } }
/// <summary> /// Unsubscribes from a notification. /// </summary> /// <param name="notificationSubscriptionManager">Notification subscription manager</param> /// <param name="user">User.</param> /// <param name="notificationName">Name of the notification.</param> /// <param name="entityIdentifier">entity identifier</param> public static void Unsubscribe(this INotificationSubscriptionManager notificationSubscriptionManager, UserIdentifier user, string notificationName, EntityIdentifier entityIdentifier = null) { AsyncHelper.RunSync(() => notificationSubscriptionManager.UnsubscribeAsync(user, notificationName, entityIdentifier)); }
public async Task UnsubscribeAsync([NotNull] string notificationName) { await _subscriptionManager.UnsubscribeAsync(CurrentUser.Id.Value, notificationName); }
public async Task UnsubscribeAsync(string notificationName) { await _notificationSubscriptionManager.UnsubscribeAsync(LoginIdentifier, notificationName); }