1
0
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:
Enrico Fasoli 2015-12-12 13:25:55 +01:00
parent 2fc14841e4
commit b73704f08c

View File

@ -424,6 +424,7 @@ BoardsAPI.prototype.getCommentsFor = function(parent,board,adminID,target){
if(err2){
this.ee.emit('error',err2)
} else if(typeof obj.previous == 'string'){
// Also get comments for the previous version of the 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))
}
})
// 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
this.ee.on('approved comments for '+board+'@'+adminID,ret => {
ret.forEach(item => this.downloadComment(item.hash,adminID,board,target))