Hacks for posts importer

main
Inga 🏳‍🌈 13 years ago
parent a04462dd22
commit a72dfa90c6
  1. 2
      FLocal.Common/UploadManager.cs
  2. 21
      FLocal.Common/dataobjects/Thread.cs

@ -29,7 +29,7 @@ namespace FLocal.Common {
}
private const int MAX_UPLOAD_FILESIZE = 1024*1024;
private const int MAX_UPLOAD_FILESIZE = 10*1024*1024;
private static HashSet<string> allowedExtensions = new HashSet<string>() {
"jpg",

@ -423,14 +423,16 @@ namespace FLocal.Common.dataobjects {
{ Post.TableSpec.FIELD_PARENTPOSTID, new ScalarFieldValue(parentPostId) },
{ Post.TableSpec.FIELD_POSTERID, new ScalarFieldValue(poster.id.ToString()) },
{ Post.TableSpec.FIELD_POSTDATE, new ScalarFieldValue(date.ToUTCString()) },
{ Post.TableSpec.FIELD_REVISION, new ScalarFieldValue("0") },
//{ Post.TableSpec.FIELD_REVISION, new ScalarFieldValue("0") },
{ Post.TableSpec.FIELD_LASTCHANGEDATE, new ScalarFieldValue(date.ToUTCString()) },
{ Post.TableSpec.FIELD_LAYERID, new ScalarFieldValue(layer.id.ToString()) },
{ Post.TableSpec.FIELD_TITLE, new ScalarFieldValue(title) },
{ Post.TableSpec.FIELD_BODY, new ScalarFieldValue(bodyIntermediate) },
{ Post.TableSpec.FIELD_TOTALPUNISHMENTS, new ScalarFieldValue("0") },
};
if(forcedPostId.HasValue) {
if(!forcedPostId.HasValue) {
postInsertData[Post.TableSpec.FIELD_REVISION] = new ScalarFieldValue("0");
} else {
postInsertData[Post.TableSpec.FIELD_ID] = new ScalarFieldValue(forcedPostId.Value.ToString());
}
AbstractChange postInsert = new InsertChange(
@ -472,12 +474,15 @@ namespace FLocal.Common.dataobjects {
},
poster.id
);
List<AbstractChange> changes = new List<AbstractChange> {
postInsert,
revisionInsert,
threadUpdate,
userUpdate,
};
List<AbstractChange> changes = new List<AbstractChange>();
changes.Add(postInsert);
if(!forcedPostId.HasValue) {
//dirty hack
changes.Add(revisionInsert);
}
changes.Add(threadUpdate);
changes.Add(userUpdate);
Dictionary<string, AbstractFieldValue> boardData = new Dictionary<string,AbstractFieldValue> {

Loading…
Cancel
Save