diff options
| author | stone <jules+okfprojz@okfoc.us> | 2017-09-25 13:08:10 -0400 |
|---|---|---|
| committer | stone <jules+okfprojz@okfoc.us> | 2017-09-25 13:08:10 -0400 |
| commit | 252a7e4cfdf4d7fccc1ce2a50cfa7ab2f33903fc (patch) | |
| tree | 00f404f7e87b20b6edefce2e52dff55ad8677a7f | |
| parent | 9fef3483d9c3b2e5e3508b8e5bb5ed080e65ca93 (diff) | |
| parent | bdba73ab985fdd6112f36dff02cd0eff937759b1 (diff) | |
Merge branch 'cms' of ghghgh.us:stone-island into cms
| -rw-r--r-- | lib/okpush/apn.js | 2 | ||||
| -rw-r--r-- | lib/okpush/db.js | 5 | ||||
| -rw-r--r-- | lib/okpush/index.js | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/okpush/apn.js b/lib/okpush/apn.js index c1430012..da883602 100644 --- a/lib/okpush/apn.js +++ b/lib/okpush/apn.js @@ -18,7 +18,7 @@ function push (channel, note) { console.error("Error fetching devices:", err) return } - // console.log(note, tokens) + console.log(note, tokens) apnProvider.send(note, tokens).then( function (response) { // response.sent.forEach( function (token) { // notificationSent(user, token) diff --git a/lib/okpush/db.js b/lib/okpush/db.js index 09afdf34..4e000725 100644 --- a/lib/okpush/db.js +++ b/lib/okpush/db.js @@ -109,7 +109,7 @@ function getDeviceCount (channels, cb) { /* notifications */ -function addNotification (channel, cb) { +function addNotification (channel, message, cb) { var now = new Date Channel.findOrCreate({channel: channel}, {last_push: now}, function(err, note, created) { if (err) { @@ -123,8 +123,9 @@ function addNotification (channel, cb) { } cb(null, note) }) - new Notification ({ + return new Notification ({ channel: channel, + message: message || "", date: now, }).save() } diff --git a/lib/okpush/index.js b/lib/okpush/index.js index a0211bed..c202c681 100644 --- a/lib/okpush/index.js +++ b/lib/okpush/index.js @@ -131,7 +131,7 @@ function OKPush (options) { } var note = apn.buildPayload(opt, options.config.bundleId) apn.push('hub', note) - db.addNotification(channel, function(){ + db.addNotification('custom', function(){ res.sendStatus(200) }) }) |
