Esempio n. 1
0
        private static void SendCommentUpdates(Comment c, Bookmark b)
        {
            if (c == null || b == null)
            {
                return;
            }
            var url  = ModifyBookmarkUrl(b);
            var tags = new[] {
                new TagValue(BookmarkSubscriptionConstants.BookmarkTitle, b.Name),
                new TagValue(BookmarkSubscriptionConstants.BookmarkUrl, url),
                new TagValue(BookmarkSubscriptionConstants.UserURL,
                             BookmarkingBusinessUtil.RenderProfileLink(c.UserID)),
                new TagValue(BookmarkSubscriptionConstants.Date, c.Datetime.ToShortString()),
                new TagValue(BookmarkSubscriptionConstants.CommentBody, c.Content)
            };

            var mentionedUsers   = MentionProvider.GetMentionedUsers(c.Content);
            var mentionedUserIds = mentionedUsers.Select(u => u.ID.ToString());

            var provider = BookmarkingNotifySource.Instance.GetSubscriptionProvider();

            var objectID = b.ID.ToString(CultureInfo.InvariantCulture);

            var recipients = provider
                             .GetRecipients(BookmarkingBusinessConstants.NotifyActionNewComment, objectID)
                             .Where(r => !mentionedUserIds.Contains(r.ID))
                             .ToArray();

            SendBookmarkNoticeToAsync(BookmarkingBusinessConstants.NotifyActionNewComment, objectID, recipients, tags);

            if (mentionedUsers.Length > 0)
            {
                SendBookmarkNoticeToAsync(BookmarkingBusinessConstants.NotifyActionMentionForBookmarkComment, objectID, mentionedUsers, tags);
            }
        }
Esempio n. 2
0
        private static void SendCommentUpdates(Comment c, Bookmark b)
        {
            if (c == null || b == null)
            {
                return;
            }
            var url  = ModifyBookmarkUrl(b);
            var tags = new[] {
                new TagValue(BookmarkSubscriptionConstants.BookmarkTitle, b.Name),
                new TagValue(BookmarkSubscriptionConstants.BookmarkUrl, url),
                new TagValue(BookmarkSubscriptionConstants.UserURL,
                             BookmarkingBusinessUtil.RenderProfileLink(c.UserID)),
                new TagValue(BookmarkSubscriptionConstants.Date, c.Datetime.ToShortString()),
                new TagValue(BookmarkSubscriptionConstants.CommentBody, c.Content), GetReplyToTag(b, c)
            };

            var objectID = b.ID.ToString(CultureInfo.InvariantCulture);

            var action = BookmarkingBusinessConstants.NotifyActionNewComment;

            SendBookmarkNoticeAsync(action, objectID, tags);
        }