mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-10 12:24:20 +01:00
download comments from users in the whitelist
This commit is contained in:
parent
2fc14841e4
commit
b73704f08c
@ -424,6 +424,7 @@ BoardsAPI.prototype.getCommentsFor = function(parent,board,adminID,target){
|
|||||||
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'){
|
||||||
|
// Also get comments for the previous version of the parent!
|
||||||
this.getCommentsFor(obj.previous,board,adminID,parent)
|
this.getCommentsFor(obj.previous,board,adminID,parent)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -435,6 +436,15 @@ BoardsAPI.prototype.getCommentsFor = function(parent,board,adminID,target){
|
|||||||
res.forEach(item => this.downloadComment(item.hash,adminID,board,target))
|
res.forEach(item => this.downloadComment(item.hash,adminID,board,target))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// Download comments from whitelisted
|
||||||
|
this.ee.on('whitelist for '+board+'@'+adminID, whitelist => {
|
||||||
|
// download posts for each user in whitelist
|
||||||
|
whitelist.forEach(item => {
|
||||||
|
this.getUserCommentList(parent,item,(err,res) => {
|
||||||
|
res.forEach(i => this.downloadComment(i.hash,adminID,board,target))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
// Handle approved comments
|
// Handle approved comments
|
||||||
this.ee.on('approved comments for '+board+'@'+adminID,ret => {
|
this.ee.on('approved comments for '+board+'@'+adminID,ret => {
|
||||||
ret.forEach(item => this.downloadComment(item.hash,adminID,board,target))
|
ret.forEach(item => this.downloadComment(item.hash,adminID,board,target))
|
||||||
|
Loading…
Reference in New Issue
Block a user