Example #1
0
 private void CommentChanged(DateTime eventTime, CommentBE comment, PageBE parent, UserBE user, params string[] channelPath)
 {
     try {
         XUri     channel  = _channel.At(COMMENTS).At(channelPath);
         XUri     resource = CommentBL.GetUri(comment).WithHost(_wikiid);
         string[] origin   = new string[] { CommentBL.GetUri(comment).AsServerUri().ToString() };
         string   path     = parent.Title.AsUiUriPath() + "#comment" + comment.Number;
         XDoc     doc      = new XDoc("deki-event")
                             //userid is deprecated and user/id should be used instead
                             .Elem("userid", comment.PosterUserId)
                             .Elem("pageid", comment.PageId)
                             .Elem("uri.page", PageBL.GetUriCanonical(parent).AsServerUri().ToString())
                             .Start("user")
                             .Attr("id", user.ID)
                             .Attr("anonymous", UserBL.IsAnonymous(user))
                             .Elem("uri", UserBL.GetUri(user))
                             .End()
                             .Elem("channel", channel)
                             .Elem("uri", CommentBL.GetUri(comment).AsServerUri().ToString())
                             .Elem("path", path)
                             .Start("content").Attr("uri", CommentBL.GetUri(comment).AsServerUri().At("content").ToString()).End();
         if (comment.Content.Length < 255)
         {
             doc["content"].Attr("type", comment.ContentMimeType).Value(comment.Content);
         }
         Queue(eventTime, channel, resource, origin, doc);
     } catch (Exception e) {
         _log.WarnMethodCall("CommentChanged", "event couldn't be created");
     }
 }