mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-26 15:04:19 +01:00
wip aggregation implementation
This commit is contained in:
parent
fe7ea88d6a
commit
d8f744301f
@ -309,16 +309,13 @@ BoardsAPI.prototype.retrieveListOfApproved = function(what,addr,adminID,board){
|
|||||||
|
|
||||||
BoardsAPI.prototype.getAllowedContentProducers = function(adminID,board,options){
|
BoardsAPI.prototype.getAllowedContentProducers = function(adminID,board,options){
|
||||||
if(!options) return
|
if(!options) return
|
||||||
this.ee.on('settings for'+board+'@'+adminID,function(settings,addr){
|
this.ee.on('settings for '+board+'@'+adminID,function(settings,addr){
|
||||||
// Get stuff based on settings
|
// Get stuff based on settings
|
||||||
if(settings.approval_required == true){
|
if(settings.approval_required == true){
|
||||||
// Get approved posts list
|
// Get approved posts list
|
||||||
if(options.posts) this.retrieveListOfApproved('posts',addr,adminID,board)
|
if(options.posts) this.retrieveListOfApproved('posts',addr,adminID,board)
|
||||||
// Get approved comments list
|
// Get approved comments list
|
||||||
if(options.comments) this.retrieveListOfApproved('comments',addr,adminID,board)
|
if(options.comments) this.retrieveListOfApproved('comments',addr,adminID,board)
|
||||||
if(settings.whitelist == true){
|
|
||||||
// TODO: emit all whitelisted users
|
|
||||||
}
|
|
||||||
} else if(settings.whitelist_only == true){
|
} else if(settings.whitelist_only == true){
|
||||||
// TODO: emit all whitelisted users
|
// TODO: emit all whitelisted users
|
||||||
} else if(settings.blacklist == true){
|
} else if(settings.blacklist == true){
|
||||||
@ -335,13 +332,22 @@ BoardsAPI.prototype.getPostsInBoard = function(adminID,board){
|
|||||||
// Automatically download approved posts
|
// Automatically download approved posts
|
||||||
ret.forEach(item => this.downloadPost(item.hash,adminID,board))
|
ret.forEach(item => this.downloadPost(item.hash,adminID,board))
|
||||||
})
|
})
|
||||||
|
this.ee.on('whitelist for '+board+'@'+adminID, whitelist => {
|
||||||
|
// download posts for each user in whitelist
|
||||||
|
whitelist.forEach(item => {
|
||||||
|
this.getUserPostListInBoard(item,board,(err,postList) => {
|
||||||
|
postList.forEach( i => this.downloadPost(i,adminID,board))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// Get allowed content and content producers
|
||||||
|
this.getAllowedContentProducers(adminID,board,{ posts: true })
|
||||||
// Get the admin's posts
|
// Get the admin's posts
|
||||||
this.getUserPostListInBoard(adminID,board,(err,res) => {
|
this.getUserPostListInBoard(adminID,board,(err,res) => {
|
||||||
if(err){
|
if(err){
|
||||||
console.log(err)
|
console.log(err)
|
||||||
} else res.forEach(item => this.downloadPost(item.hash,adminID,board,adminID))
|
} else res.forEach(item => this.downloadPost(item.hash,adminID,board,adminID))
|
||||||
})
|
})
|
||||||
this.getAllowedContentProducers(adminID,board,{ posts: true })
|
|
||||||
} else {
|
} else {
|
||||||
// TODO: Download all posts in board from everyone
|
// TODO: Download all posts in board from everyone
|
||||||
// Download my posts
|
// Download my posts
|
||||||
|
Loading…
Reference in New Issue
Block a user