public void SendNotification(UserMentionNotificationModel model)
        {
            const NotificationTypeEnum notificationType = NotificationTypeEnum.UserMention;

            foreach (var receivedId in model.ReceivedIds)
            {
                if (SkipNotification(receivedId, model.MentionedSourceId))
                {
                    continue;
                }
                var notifierData = new NotifierData
                {
                    NotificationType = notificationType,
                    ActivityType     = model.ActivityType,
                    ReceiverIds      = receivedId.ToEnumerable(),
                    Value            = new UserMentionNotifierDataModel
                    {
                        MentionedSourceId = model.MentionedSourceId,
                        Title             = model.Title,
                        Url              = model.Url.ToLinkModel(),
                        NotifierId       = model.CreatorId,
                        ReceiverId       = receivedId,
                        NotificationType = notificationType
                    }
                };

                _notificationService.ProcessNotification(notifierData);
            }
        }
Exemple #2
0
        public BroadcastResult Handle(MentionCommand command)
        {
            var notifierData = new UserMentionNotificationModel()
            {
                CreatorId         = command.CreatorId,
                ReceivedIds       = command.MentionedUserIds,
                Title             = command.Title,
                Url               = command.Url,
                MentionedSourceId = command.MentionedSourceId,
                ActivityType      = command.ActivityType
            };

            _notificationService.SendNotification(notifierData);

            return(BroadcastResult.Success);
        }