private NotifierData GetNotifierData(Guid entityId, Enum notificationType) { var currentMember = _memberService.GetCurrentMember(); var data = new NotifierData { NotificationType = notificationType, ActivityType = Type, }; switch (notificationType) { case NotificationTypeEnum.CommentLikeAdded: case NotificationTypeEnum.CommentReplied: { var comment = _commentsService.Get(entityId); data.ReceiverIds = comment.UserId.ToEnumerableOfOne(); var currentContentPage = _nodeModelService.Get(_requestContext.Node.Id); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(currentContentPage, comment, notificationType, currentMember.Id); } break; default: throw new InvalidOperationException(); } return(data); }
private NotifierData GetNotifierData(Guid entityId, Enum notificationType) { var data = new NotifierData { NotificationType = notificationType, ActivityType = Type }; var currentUser = _intranetUserService.GetCurrentUser(); switch (notificationType) { case NotificationTypeEnum.ActivityLikeAdded: { var bulletinsEntity = Get(entityId); data.ReceiverIds = bulletinsEntity.OwnerId.ToEnumerable(); data.Value = _notifierDataHelper.GetLikesNotifierDataModel(bulletinsEntity, notificationType, currentUser.Id); } break; case NotificationTypeEnum.CommentAdded: case NotificationTypeEnum.CommentEdited: { var comment = _commentsService.Get(entityId); var bulletinsEntity = Get(comment.ActivityId); data.ReceiverIds = bulletinsEntity.OwnerId.ToEnumerable(); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(bulletinsEntity, comment, notificationType, comment.UserId); } break; case NotificationTypeEnum.CommentReplied: { var comment = _commentsService.Get(entityId); var bulletinsEntity = Get(comment.ActivityId); data.ReceiverIds = comment.UserId.ToEnumerable(); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(bulletinsEntity, comment, notificationType, currentUser.Id); } break; case NotificationTypeEnum.CommentLikeAdded: { var comment = _commentsService.Get(entityId); var bulletinsEntity = Get(comment.ActivityId); data.ReceiverIds = currentUser.Id == comment.UserId ? Enumerable.Empty <Guid>() : comment.UserId.ToEnumerable(); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(bulletinsEntity, comment, notificationType, currentUser.Id); } break; default: return(null); } return(data); }
private NotifierData GetNotifierData(Guid entityId, Enum notificationType) { var currentUser = _userService.GetCurrentUser(); var data = new NotifierData() { NotificationType = notificationType, ActivityType = Type, }; switch (notificationType) { case NotificationTypeEnum.CommentLikeAdded: case NotificationTypeEnum.CommentReplied: { var comment = _commentsService.Get(entityId); data.ReceiverIds = comment.UserId.ToEnumerable(); var currentContentPage = _umbracoHelper.TypedContent(comment.ActivityId); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(currentContentPage, comment, notificationType, currentUser.Id); } break; default: return(null); } return(data); }
public NotifierData GetNotifierData <TActivity>(CommentModel comment, TActivity activity, Enum notificationType) where TActivity : IIntranetActivity, IHaveOwner { var currentMember = _intranetMemberService.GetCurrentMember(); var data = new NotifierData { NotificationType = notificationType, ActivityType = activity.Type, ReceiverIds = ReceiverIds(comment, activity, notificationType, currentMember).Except(currentMember.Id.ToEnumerableOfOne()), Value = _notifierDataHelper.GetCommentNotifierDataModel(activity, comment, notificationType, currentMember.Id) }; return(data); }
internal INotifierDataValue GetNotifierDataValue(OldNotifierData oldData, IIntranetActivity activity, Enum notificationType) { INotifierDataValue result; switch (notificationType) { case NotificationTypeEnum.ActivityLikeAdded: { result = _notifierDataHelper.GetLikesNotifierDataModel(activity, notificationType, oldData.NotifierId); break; } case NotificationTypeEnum.CommentAdded: case NotificationTypeEnum.CommentReplied: case NotificationTypeEnum.CommentEdited: case NotificationTypeEnum.CommentLikeAdded: { var commentId = ParseCommentId(oldData.Url); var comment = _commentsService.Get(commentId); result = _notifierDataHelper.GetCommentNotifierDataModel(activity, comment, notificationType, oldData.NotifierId); break; } case NotificationTypeEnum.BeforeStart: { result = _notifierDataHelper.GetActivityReminderDataModel(activity, notificationType); break; } case NotificationTypeEnum.EventHided: case NotificationTypeEnum.EventUpdated: { result = _notifierDataHelper.GetActivityNotifierDataModel(activity, notificationType, oldData.NotifierId); break; } default: result = null; break; } return(result); }
private NotifierData GetNotifierData(Guid entityId, Enum notificationType) { var currentUser = _intranetUserService.GetCurrentUser(); var data = new NotifierData { NotificationType = notificationType, ActivityType = Type }; switch (notificationType) { case NotificationTypeEnum.CommentReplied: { var comment = _commentsService.Get(entityId); var currentEvent = Get(comment.ActivityId); data.ReceiverIds = comment.UserId.ToEnumerable(); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, currentUser.Id); } break; case NotificationTypeEnum.CommentEdited: { var comment = _commentsService.Get(entityId); var currentEvent = Get(comment.ActivityId); data.ReceiverIds = currentEvent.OwnerId.ToEnumerable(); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, comment.UserId); } break; case NotificationTypeEnum.CommentAdded: { var comment = _commentsService.Get(entityId); var currentEvent = Get(comment.ActivityId); data.ReceiverIds = GetNotifiedSubscribers(currentEvent).Concat(currentEvent.OwnerId.ToEnumerable()).Distinct(); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, comment.UserId); } break; case NotificationTypeEnum.ActivityLikeAdded: { var currentEvent = Get(entityId); data.ReceiverIds = currentEvent.OwnerId.ToEnumerable(); data.Value = _notifierDataHelper.GetLikesNotifierDataModel(currentEvent, notificationType, currentUser.Id); } break; case NotificationTypeEnum.CommentLikeAdded: { var comment = _commentsService.Get(entityId); var currentEvent = Get(comment.ActivityId); data.ReceiverIds = currentUser.Id == comment.UserId ? Enumerable.Empty <Guid>() : comment.UserId.ToEnumerable(); data.Value = _notifierDataHelper.GetCommentNotifierDataModel(currentEvent, comment, notificationType, currentUser.Id); } break; case NotificationTypeEnum.BeforeStart: { var currentEvent = Get(entityId); data.ReceiverIds = GetNotifiedSubscribers(currentEvent); data.Value = _notifierDataHelper.GetActivityReminderDataModel(currentEvent, notificationType); } break; case NotificationTypeEnum.EventHided: case NotificationTypeEnum.EventUpdated: { var currentEvent = Get(entityId); data.ReceiverIds = GetNotifiedSubscribers(currentEvent); data.Value = _notifierDataHelper.GetActivityNotifierDataModel(currentEvent, notificationType, currentUser.Id); } break; default: return(null); } return(data); }