Compare commits

..

3 Commits

Author SHA1 Message Date
f873bf354a fix bug 33278 2016-10-25 17:15:06 +03:00
e3635eb0f6 support new history 2016-10-14 17:12:00 +03:00
bd784224b9 changeshistory -> history 2016-10-14 15:28:27 +03:00
2 changed files with 12 additions and 13 deletions

View File

@ -324,10 +324,10 @@ app.post("/track", function (req, res) {
fileSystem.writeFileSync(path_changes, diffZip.getBody());
}
var changeshistory = body.changeshistory;
var changeshistory = body.changeshistory || JSON.stringify(body.history);
if (changeshistory) {
var path_changes_json = docManager.changesPath(fileName, userAddress, version);
fileSystem.writeFileSync(path_changes_json, body.changeshistory);
fileSystem.writeFileSync(path_changes_json, changeshistory);
}
var path_key = docManager.keyPath(fileName, userAddress, version);

View File

@ -330,18 +330,17 @@ docManager.getHistory = function (fileName, content, keyVersion, version) {
var userAddress = docManager.curUserHostAddress();
var username = content ? (oldVersion ? contentJson.username : contentJson.user.name) : (docManager.getFileData(fileName, userAddress))[2];
var userid = content ? (oldVersion ? contentJson.userid : contentJson.user.id) : (docManager.getFileData(fileName, userAddress))[1];
var date = content ? (oldVersion ? contentJson.date : contentJson.created) : (docManager.getFileData(fileName, userAddress))[0];
return {
key: keyVersion,
version: version,
created: date,
user: {
id: userid,
name: username
},
changes: content
var created = content ? (oldVersion ? contentJson.date : contentJson.created) : (docManager.getFileData(fileName, userAddress))[0];
var res = (content && !oldVersion) ? content : {changes: content};
res.key = keyVersion;
res.version = version;
res.created = created;
res.user = {
id: userid,
name: username
};
return res;
};
module.exports = docManager;