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 }); } }
private void ResolveMentions(string text, EventBase @event) { var mentionIds = _mentionService.GetMentions(text).ToList(); if (mentionIds.Any()) { var links = _activityLinkService.GetLinks(@event.Id); _mentionService.ProcessMention(new MentionModel() { MentionedSourceId = @event.Id, CreatorId = _intranetMemberService.GetCurrentMemberId(), MentionedUserIds = mentionIds, Title = @event.Title.StripHtml(), Url = links.Details, ActivityType = IntranetActivityTypeEnum.Events }); } }
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 }); } }
private void ResolveMentions(string text, BulletinBase bulletin) { var mentionIds = _mentionService.GetMentions(text).ToList(); if (mentionIds.Any()) { var links = _activityLinkService.GetLinks(bulletin.Id); const int maxTitleLength = 100; _mentionService.ProcessMention(new MentionModel() { MentionedSourceId = bulletin.Id, CreatorId = _intranetUserService.GetCurrentUserId(), MentionedUserIds = mentionIds, Title = bulletin.Description.StripHtml().TrimByWordEnd(maxTitleLength), Url = links.Details, ActivityType = IntranetActivityTypeEnum.Bulletins }); } }
private async Task ResolveMentionsAsync(string text, SocialBase social) { var mentionIds = _mentionService.GetMentions(text).ToList(); if (mentionIds.Any()) { var links = await _activityLinkService.GetLinksAsync(social.Id); const int maxTitleLength = 100; _mentionService.ProcessMention(new MentionModel() { MentionedSourceId = social.Id, CreatorId = await _memberService.GetCurrentMemberIdAsync(), MentionedUserIds = mentionIds, Title = social.Description.StripMentionHtml().TrimByWordEnd(maxTitleLength), Url = links.Details, ActivityType = IntranetActivityTypeEnum.Social }); } }
private async Task ResolveMentionsAsync(string text, NewsBase news) { var mentionIds = _mentionService.GetMentions(text).ToArray(); if (!mentionIds.Any()) { return; } var links = await _activityLinkService.GetLinksAsync(news.Id); _mentionService.ProcessMention( new MentionModel { MentionedSourceId = news.Id, CreatorId = await _intranetMemberService.GetCurrentMemberIdAsync(), MentionedUserIds = mentionIds, Title = news.Title?.StripMentionHtml(), Url = links.Details, ActivityType = IntranetActivityTypeEnum.News }); }