mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
can edit and add an image to a post, still cant remove previously added images #issue #233
This commit is contained in:
@@ -55,7 +55,7 @@ var RDB = require('./redis.js'),
|
||||
});
|
||||
}
|
||||
|
||||
PostTools.edit = function(uid, pid, title, content) {
|
||||
PostTools.edit = function(uid, pid, title, content, images) {
|
||||
var success = function() {
|
||||
posts.setPostField(pid, 'content', content);
|
||||
posts.setPostField(pid, 'edited', Date.now());
|
||||
@@ -66,6 +66,11 @@ var RDB = require('./redis.js'),
|
||||
});
|
||||
|
||||
async.parallel([
|
||||
function(next) {
|
||||
posts.uploadPostImages(pid, images, function(err, uploadedImages) {
|
||||
next(err, uploadedImages);
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
posts.getPostField(pid, 'tid', function(tid) {
|
||||
PostTools.isMain(pid, tid, function(isMainPost) {
|
||||
@@ -76,7 +81,7 @@ var RDB = require('./redis.js'),
|
||||
});
|
||||
}
|
||||
|
||||
next(null, tid);
|
||||
next(null, {tid:tid, isMainPost:isMainPost});
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -84,10 +89,12 @@ var RDB = require('./redis.js'),
|
||||
PostTools.toHTML(content, next);
|
||||
}
|
||||
], function(err, results) {
|
||||
io.sockets.in('topic_' + results[0]).emit('event:post_edited', {
|
||||
io.sockets.in('topic_' + results[1].tid).emit('event:post_edited', {
|
||||
pid: pid,
|
||||
title: title,
|
||||
content: results[1]
|
||||
isMainPost: results[1].isMainPost,
|
||||
content: results[2],
|
||||
uploadedImages:results[0]
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user