diff --git a/lib/boards-api.js b/lib/boards-api.js
index 48b88ec..574b624 100644
--- a/lib/boards-api.js
+++ b/lib/boards-api.js
@@ -281,7 +281,10 @@ BoardsAPI.prototype.downloadPost = function(hash,adminID,board,op,done){
var post = JSON.parse(r.toString())
post.hash = hash
if(op) post.op = op // Inject op
- if(board) this.ee.emit('post in '+board+'@'+adminID,post,hash)
+ if(board){
+ if(adminID) this.ee.emit('post in '+board+'@'+adminID,post,hash)
+ else this.ee.emit('post in '+board,post,hash)
+ }
this.ee.emit(hash,post,adminID,board)
if(done && done.apply) done(null,post)
}
@@ -327,17 +330,27 @@ BoardsAPI.prototype.getAllowedContentProducers = function(adminID,board,options)
}
BoardsAPI.prototype.getPostsInBoard = function(adminID,board){
- this.ee.on('approved posts for '+board+'@'+adminID,ret => {
- // Automatically download approved posts
- ret.forEach(item => this.downloadPost(item.hash,adminID,board))
- })
- // Get the admin's posts
- this.getUserPostListInBoard(adminID,board,(err,res) => {
- if(err){
- console.log(err)
- } else res.forEach(item => this.downloadPost(item.hash,adminID,board,adminID))
- })
- this.getAllowedContentProducers(adminID,board,{ posts: true })
+ if(adminID){
+ this.ee.on('approved posts for '+board+'@'+adminID,ret => {
+ // Automatically download approved posts
+ ret.forEach(item => this.downloadPost(item.hash,adminID,board))
+ })
+ // Get the admin's posts
+ this.getUserPostListInBoard(adminID,board,(err,res) => {
+ if(err){
+ console.log(err)
+ } else res.forEach(item => this.downloadPost(item.hash,adminID,board,adminID))
+ })
+ this.getAllowedContentProducers(adminID,board,{ posts: true })
+ } else {
+ // TODO: Download all posts in board from everyone
+ // Download my posts
+ this.getUserPostListInBoard(this.id,board,(err,res) => {
+ if(err){
+ console.log(err)
+ } else res.forEach(item => this.downloadPost(item.hash,undefined,board,this.id))
+ })
+ }
return this.ee
}
diff --git a/webapp/app.jsx b/webapp/app.jsx
index 624a190..96aa233 100644
--- a/webapp/app.jsx
+++ b/webapp/app.jsx
@@ -90,6 +90,7 @@ ReactDOM.render(