mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-02-09 17:14:19 +01:00
fix #72
This commit is contained in:
parent
6b54ec8b30
commit
519417b6ec
@ -691,7 +691,6 @@ BoardsAPI.prototype.downloadComment = function (hash, adminID, board, target, do
|
|||||||
done = target
|
done = target
|
||||||
target = undefined
|
target = undefined
|
||||||
}
|
}
|
||||||
console.log('target', target)
|
|
||||||
this.cat(hash, (err2, r) => {
|
this.cat(hash, (err2, r) => {
|
||||||
if (err2) {
|
if (err2) {
|
||||||
this.ee.emit('error', err2)
|
this.ee.emit('error', err2)
|
||||||
@ -713,9 +712,9 @@ BoardsAPI.prototype.downloadComment = function (hash, adminID, board, target, do
|
|||||||
return this.ee
|
return this.ee
|
||||||
}
|
}
|
||||||
|
|
||||||
BoardsAPI.prototype.getCommentsFor = function (parent, board, adminID, target) {
|
BoardsAPI.prototype.getCommentsFor = function (parent, board, adminID, target, list = [parent]) {
|
||||||
if (!parent || !board || !adminID) {
|
if (!parent || !board || !adminID) {
|
||||||
return console.log('malformed arguments:', parent, board, adminID)
|
return console.log('malformed arguments:', parent, board, adminID, target, list)
|
||||||
}
|
}
|
||||||
// figure out if there's a previous version of the item
|
// figure out if there's a previous version of the item
|
||||||
this.cat(parent, (err, res) => {
|
this.cat(parent, (err, res) => {
|
||||||
@ -725,9 +724,9 @@ BoardsAPI.prototype.getCommentsFor = function (parent, board, adminID, target) {
|
|||||||
replyAsObj(res, true, (err2, obj) => {
|
replyAsObj(res, true, (err2, obj) => {
|
||||||
if (err2) {
|
if (err2) {
|
||||||
this.ee.emit('error', err2)
|
this.ee.emit('error', err2)
|
||||||
} else if (typeof obj.previous === 'string') {
|
} else if (typeof obj.previous === 'string' && list.indexOf(obj.previous) < 0) {
|
||||||
// Also get comments for the previous version of the parent!
|
// Also get comments for the previous version of the parent!
|
||||||
this.getCommentsFor(obj.previous, board, adminID, parent)
|
this.getCommentsFor(obj.previous, board, adminID, (target || parent), list.concat(obj.previous))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user