mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-30 20:30:32 +01:00
WIP post diffs
This commit is contained in:
@@ -20,6 +20,7 @@ module.exports = function (Posts) {
|
||||
});
|
||||
|
||||
Posts.edit = function (data, callback) {
|
||||
var oldContent; // for diffing purposes
|
||||
var postData;
|
||||
var results;
|
||||
|
||||
@@ -39,6 +40,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
|
||||
postData = _postData;
|
||||
oldContent = postData.content;
|
||||
postData.content = data.content;
|
||||
postData.edited = Date.now();
|
||||
postData.editor = data.uid;
|
||||
@@ -63,6 +65,9 @@ module.exports = function (Posts) {
|
||||
results = _results;
|
||||
Posts.setPostFields(data.pid, postData, next);
|
||||
},
|
||||
function (next) {
|
||||
Posts.diffs.save(data.pid, oldContent, data.content, next);
|
||||
},
|
||||
function (next) {
|
||||
postData.cid = results.topic.cid;
|
||||
postData.topic = results.topic;
|
||||
|
||||
Reference in New Issue
Block a user