Fixed some bugs with import of discussion threads?

main
Inga 🏳‍🌈 13 years ago
parent 12b523400b
commit 85ea1bbee6
  1. 15
      FLocal.Migration.Console/ShallerDBProcessor.cs

@ -253,12 +253,14 @@ namespace FLocal.Migration.Console {
layer = PostLayer.LoadById(int.Parse(data["Layer"])); layer = PostLayer.LoadById(int.Parse(data["Layer"]));
} }
inserts[postId] = () => { inserts[postId] = () => {
bool isDiscussion = false;
if(postId == main || postId == localMain) { if(postId == main || postId == localMain) {
//first post in the thread //first post in the thread
string legacyBoardName; string legacyBoardName;
if(localMain != 0) { if(discussions.ContainsKey(main) || (localMain != 0 && (localMain != postId || localMain != main))) {
discussionsIds.Add(main); discussionsIds.Add(main);
legacyBoardName = discussions[main]; legacyBoardName = discussions[main];
isDiscussion = true;
} else { } else {
legacyBoardName = data["Board"]; legacyBoardName = data["Board"];
} }
@ -277,13 +279,18 @@ namespace FLocal.Migration.Console {
parentId = main; parentId = main;
} }
} }
Post post; Post parent;
try { try {
post = Post.LoadById(parentId); parent = Post.LoadById(parentId);
} catch(NotFoundInDBException) { } catch(NotFoundInDBException) {
throw new ApplicationException("Cannot find parent post #" + parentId); throw new ApplicationException("Cannot find parent post #" + parentId);
} }
post.Reply(user, title, body, layer, date, postId);
if(!isDiscussion && parent.thread.firstPostId != localMain) {
System.Console.Write("d");
} else {
parent.Reply(user, title, body, layer, date, postId);
}
} }
}; };
System.Console.Write("+"); System.Console.Write("+");

Loading…
Cancel
Save