diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 71ed48c..1307450 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -954 \ No newline at end of file +956 \ No newline at end of file diff --git a/Common/dataobjects/Board.cs b/Common/dataobjects/Board.cs index 5e5f866..74274ea 100644 --- a/Common/dataobjects/Board.cs +++ b/Common/dataobjects/Board.cs @@ -188,7 +188,7 @@ namespace FLocal.Common.dataobjects { if(!this.lastPostId.HasValue) { return new XElement("none"); } else { - return this.lastPost.exportToXml(context, false); + return this.lastPost.exportToXml(context); } } diff --git a/Common/dataobjects/Post.cs b/Common/dataobjects/Post.cs index 723e0ca..dc7c026 100644 --- a/Common/dataobjects/Post.cs +++ b/Common/dataobjects/Post.cs @@ -175,11 +175,19 @@ namespace FLocal.Common.dataobjects { ); } + public XElement exportToXmlBase(UserContext context) { + return new XElement("post", + new XElement("id", this.id), + new XElement("poster", this.poster.exportToXmlForViewing(context)), + new XElement("bodyShort", context.isPostVisible(this) ? this.bodyShort : "") + ); + } + private XNode XMLBody(UserContext context) { return XElement.Parse("" + context.outputParams.preprocessBodyIntermediate(this.body) + "", LoadOptions.PreserveWhitespace); } - public XElement exportToXml(UserContext context, bool includeParentPost, params XElement[] additional) { + public XElement exportToXml(UserContext context, params XElement[] additional) { if(!context.isPostVisible(this)) return null; @@ -204,10 +212,8 @@ namespace FLocal.Common.dataobjects { ) ) ); - if(includeParentPost) { - if(this.parentPostId.HasValue) { - result.Add(new XElement("parentPost", this.parentPost.exportToXml(context, false))); - } + if(this.parentPostId.HasValue) { + result.Add(new XElement("parentPost", this.parentPost.exportToXmlBase(context))); } if(additional.Length > 0) { result.Add(additional); diff --git a/IISMainHandler/handlers/PostHandler.cs b/IISMainHandler/handlers/PostHandler.cs index 20a4716..04e90ed 100644 --- a/IISMainHandler/handlers/PostHandler.cs +++ b/IISMainHandler/handlers/PostHandler.cs @@ -29,7 +29,7 @@ namespace FLocal.IISHandler.handlers { XElement[] result = new XElement[] { new XElement("currentLocation", post.exportToXmlSimpleWithParent(context)), post.thread.exportToXml(context), - new XElement("posts", post.exportToXml(context, true, new XElement("isUnread", (post.id > lastReadId).ToPlainString()))) + new XElement("posts", post.exportToXml(context, new XElement("isUnread", (post.id > lastReadId).ToPlainString()))) }; post.thread.incrementViewsCounter(); diff --git a/IISMainHandler/handlers/ThreadHandler.cs b/IISMainHandler/handlers/ThreadHandler.cs index 0fea333..950ccba 100644 --- a/IISMainHandler/handlers/ThreadHandler.cs +++ b/IISMainHandler/handlers/ThreadHandler.cs @@ -59,7 +59,7 @@ namespace FLocal.IISHandler.handlers { new XElement("currentLocation", thread.exportToXmlSimpleWithParent(context)), thread.exportToXml(context), new XElement("posts", - from post in posts select post.exportToXml(context, true, new XElement("isUnread", (post.id > lastReadId).ToPlainString())), + from post in posts select post.exportToXml(context, new XElement("isUnread", (post.id > lastReadId).ToPlainString())), pageOuter.exportToXml(2, 5, 2) ) }; diff --git a/IISMainHandler/handlers/request/CreateThreadHandler.cs b/IISMainHandler/handlers/request/CreateThreadHandler.cs index db5af35..fdf3195 100644 --- a/IISMainHandler/handlers/request/CreateThreadHandler.cs +++ b/IISMainHandler/handlers/request/CreateThreadHandler.cs @@ -25,7 +25,7 @@ namespace FLocal.IISHandler.handlers.request { return new XElement[] { newThread.board.exportToXml(context, false), - newPost.exportToXml(context, false) + newPost.exportToXml(context) }; } } diff --git a/IISMainHandler/handlers/request/EditHandler.cs b/IISMainHandler/handlers/request/EditHandler.cs index 4866b4f..1c38f57 100644 --- a/IISMainHandler/handlers/request/EditHandler.cs +++ b/IISMainHandler/handlers/request/EditHandler.cs @@ -17,7 +17,7 @@ namespace FLocal.IISHandler.handlers.request { protected override XElement[] Do(WebContext context) { Post post = Post.LoadById(int.Parse(context.httprequest.Form["postId"])); - XElement postXml = post.exportToXml(context, false); + XElement postXml = post.exportToXml(context); post.Edit( context.session.account.user, this.getTitle(context), diff --git a/IISMainHandler/handlers/request/ReplyHandler.cs b/IISMainHandler/handlers/request/ReplyHandler.cs index f728919..35f14a7 100644 --- a/IISMainHandler/handlers/request/ReplyHandler.cs +++ b/IISMainHandler/handlers/request/ReplyHandler.cs @@ -25,7 +25,7 @@ namespace FLocal.IISHandler.handlers.request { return new XElement[] { newPost.thread.board.exportToXml(context, false), - newPost.exportToXml(context, false) + newPost.exportToXml(context) }; } diff --git a/IISMainHandler/handlers/response/AllPostsHandler.cs b/IISMainHandler/handlers/response/AllPostsHandler.cs index d62f714..3937ab7 100644 --- a/IISMainHandler/handlers/response/AllPostsHandler.cs +++ b/IISMainHandler/handlers/response/AllPostsHandler.cs @@ -49,7 +49,7 @@ namespace FLocal.IISHandler.handlers.response { XElement[] result = new XElement[] { new XElement("posts", - from post in posts select post.exportToXml(context, true), + from post in posts select post.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }; diff --git a/IISMainHandler/handlers/response/BoardAsThread.cs b/IISMainHandler/handlers/response/BoardAsThread.cs index ac68fd2..f9a1cdb 100644 --- a/IISMainHandler/handlers/response/BoardAsThread.cs +++ b/IISMainHandler/handlers/response/BoardAsThread.cs @@ -36,11 +36,7 @@ namespace FLocal.IISHandler.handlers.response { new XElement("posts", from thread in threads select thread.firstPost.exportToXml( context, - false, - new XElement( - "specific", - thread.exportToXml(context) - ) + new XElement("specific", thread.exportToXml(context)) ), pageOuter.exportToXml(1, 5, 1) ) diff --git a/IISMainHandler/handlers/response/EditHandler.cs b/IISMainHandler/handlers/response/EditHandler.cs index fa9fcb4..248d74b 100644 --- a/IISMainHandler/handlers/response/EditHandler.cs +++ b/IISMainHandler/handlers/response/EditHandler.cs @@ -24,7 +24,7 @@ namespace FLocal.IISHandler.handlers.response { return new XElement[] { post.thread.board.exportToXml(context, false), post.thread.exportToXml(context), - post.exportToXml(context, false), + post.exportToXml(context), post.latestRevision.exportToXml(context), new XElement("layers", from layer in PostLayer.allLayers select layer.exportToXml(context) diff --git a/IISMainHandler/handlers/response/PMReplyToPostHandler.cs b/IISMainHandler/handlers/response/PMReplyToPostHandler.cs index 663b17c..2434e91 100644 --- a/IISMainHandler/handlers/response/PMReplyToPostHandler.cs +++ b/IISMainHandler/handlers/response/PMReplyToPostHandler.cs @@ -33,7 +33,7 @@ namespace FLocal.IISHandler.handlers.response { return new XElement[] { post.thread.board.exportToXml(context, false), post.thread.exportToXml(context), - post.exportToXml(context, false), + post.exportToXml(context), new XElement("receiver", Account.LoadByUser(post.poster).exportToXml(context)), new XElement("quoted", quoted), }; diff --git a/IISMainHandler/handlers/response/ReplyHandler.cs b/IISMainHandler/handlers/response/ReplyHandler.cs index 807d36a..22ca3c8 100644 --- a/IISMainHandler/handlers/response/ReplyHandler.cs +++ b/IISMainHandler/handlers/response/ReplyHandler.cs @@ -33,7 +33,7 @@ namespace FLocal.IISHandler.handlers.response { return new XElement[] { post.thread.board.exportToXml(context, false), post.thread.exportToXml(context), - post.exportToXml(context, false), + post.exportToXml(context), new XElement("layers", from layer in PostLayer.allLayers select layer.exportToXml(context) ), diff --git a/IISMainHandler/handlers/response/UserPostsHandler.cs b/IISMainHandler/handlers/response/UserPostsHandler.cs index b09b217..55e48d5 100644 --- a/IISMainHandler/handlers/response/UserPostsHandler.cs +++ b/IISMainHandler/handlers/response/UserPostsHandler.cs @@ -32,7 +32,7 @@ namespace FLocal.IISHandler.handlers.response { XElement[] result = new XElement[] { user.exportToXmlForViewing(context), new XElement("posts", - from post in posts select post.exportToXml(context, true), + from post in posts select post.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }; diff --git a/IISMainHandler/handlers/response/UserRepliesHandler.cs b/IISMainHandler/handlers/response/UserRepliesHandler.cs index 3ef267a..fda8cd9 100644 --- a/IISMainHandler/handlers/response/UserRepliesHandler.cs +++ b/IISMainHandler/handlers/response/UserRepliesHandler.cs @@ -32,7 +32,7 @@ namespace FLocal.IISHandler.handlers.response { XElement[] result = new XElement[] { user.exportToXmlForViewing(context), new XElement("posts", - from post in posts select post.exportToXml(context, true), + from post in posts select post.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) };