Post.exportToXml refactored; posts hiding logic improved

main
Inga 🏳‍🌈 14 years ago
parent 0621e83206
commit 8252fcdbfc
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Common/dataobjects/Board.cs
  3. 14
      Common/dataobjects/Post.cs
  4. 2
      IISMainHandler/handlers/PostHandler.cs
  5. 2
      IISMainHandler/handlers/ThreadHandler.cs
  6. 2
      IISMainHandler/handlers/request/CreateThreadHandler.cs
  7. 2
      IISMainHandler/handlers/request/EditHandler.cs
  8. 2
      IISMainHandler/handlers/request/ReplyHandler.cs
  9. 2
      IISMainHandler/handlers/response/AllPostsHandler.cs
  10. 6
      IISMainHandler/handlers/response/BoardAsThread.cs
  11. 2
      IISMainHandler/handlers/response/EditHandler.cs
  12. 2
      IISMainHandler/handlers/response/PMReplyToPostHandler.cs
  13. 2
      IISMainHandler/handlers/response/ReplyHandler.cs
  14. 2
      IISMainHandler/handlers/response/UserPostsHandler.cs
  15. 2
      IISMainHandler/handlers/response/UserRepliesHandler.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);
}
}

@ -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("<body>" + context.outputParams.preprocessBodyIntermediate(this.body) + "</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)));
}
result.Add(new XElement("parentPost", this.parentPost.exportToXmlBase(context)));
}
if(additional.Length > 0) {
result.Add(additional);

@ -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();

@ -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)
)
};

@ -25,7 +25,7 @@ namespace FLocal.IISHandler.handlers.request {
return new XElement[] {
newThread.board.exportToXml(context, false),
newPost.exportToXml(context, false)
newPost.exportToXml(context)
};
}
}

@ -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),

@ -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)
};
}

@ -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)
)
};

@ -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)
)

@ -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)

@ -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),
};

@ -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)
),

@ -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)
)
};

@ -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)
)
};

Loading…
Cancel
Save