File size: 500 Bytes
b3787d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict'

var _ = require('lodash')

module.exports = function fanout (options) {
  var seneca = this

  seneca.add('fanout:entry', function(msg, done) {
    done()

    var entry = this.util.clean(msg)
    delete entry.fanout

    this.act('follow:list,kind:followers',{user:entry.user},function(err,userlist){
      if(err) return

      if( userlist && 0 < userlist.length ) {
        this.act({
          timeline: 'insert',
          users: userlist,
        }, entry)
      }
    })
  })
}