Exemplo n.º 1
0
 public CommentNotifierDataModel GetCommentNotifierDataModel(IIntranetActivity activity, CommentModel comment, Enum notificationType, Guid notifierId)
 {
     return(new CommentNotifierDataModel
     {
         CommentId = comment.Id,
         NotificationType = notificationType,
         NotifierId = notifierId,
         Title = GetNotifierDataTitle(activity).TrimByWordEnd(MaxTitleLength),
         Url = _commentLinkHelper.GetDetailsUrlWithComment(activity.Id, comment.Id),
         IsPinned = activity.IsPinned,
         IsPinActual = activity.IsPinActual
     });
 }
Exemplo n.º 2
0
        private async Task ResolveMentionsAsync(CommentModel comment, IntranetEntityTypeEnum activityType)
        {
            var mentionIds = _mentionService.GetMentions(comment.Text).ToList();

            var isActivity = activityType.Is(IntranetEntityTypeEnum.Events, IntranetEntityTypeEnum.News,
                                             IntranetEntityTypeEnum.Social);

            if (mentionIds.Any())
            {
                UintraLinkModel url;

                if (isActivity)
                {
                    url = await _commentLinkHelper.GetDetailsUrlWithCommentAsync(comment.ActivityId, comment.Id);
                }
                else
                {
                    var content = _nodeModelService.AsEnumerable().FirstOrDefault(x => x.Key == comment.ActivityId);
                    url = _commentLinkHelper.GetDetailsUrlWithComment(content, comment.Id);
                }

                _mentionService.ProcessMention(new MentionModel
                {
                    MentionedSourceId = comment.Id,
                    CreatorId         = await _intranetMemberService.GetCurrentMemberIdAsync(),
                    MentionedUserIds  = mentionIds,
                    Title             = comment.Text.StripMentionHtml().TrimByWordEnd(50),
                    Url          = url,
                    ActivityType = CommunicationTypeEnum.CommunicationSettings
                });
            }
        }
Exemplo n.º 3
0
        private void ResolveMentions(string text, CommentModel comment)
        {
            var mentionIds = _mentionService.GetMentions(text).ToList();

            if (mentionIds.Any())
            {
                var content = Umbraco.TypedContent(comment.ActivityId);
                _mentionService.ProcessMention(new MentionModel
                {
                    MentionedSourceId = comment.Id,
                    CreatorId         = _intranetMemberService.GetCurrentMemberId(),
                    MentionedUserIds  = mentionIds,
                    Title             = comment.Text.StripHtml().TrimByWordEnd(50),
                    Url = content != null ? _commentLinkHelper.GetDetailsUrlWithComment(content, comment.Id) :
                          _commentLinkHelper.GetDetailsUrlWithComment(comment.ActivityId, comment.Id),
                    ActivityType = CommunicationTypeEnum.CommunicationSettings
                });
            }
        }