This commit is contained in:
barisusakli
2014-09-29 12:30:03 -04:00
parent 8b0685754e
commit d303dea6c7
5 changed files with 39 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ var async = require('async'),
user = require('../user'),
utils = require('../../public/src/utils'),
db = require('../database'),
meta = require('../meta'),
notifications = require('../notifications'),
posts = require('../posts'),
postTools = require('../postTools'),
@@ -295,6 +296,25 @@ var async = require('async'),
});
};
UserNotifications.sendWelcomeNotification = function(uid) {
if (!meta.config.welcomeNotification) {
return;
}
var path = meta.config.welcomeLink ? meta.config.welcomeLink : '#';
notifications.create({
bodyShort: meta.config.welcomeNotification,
bodyLong: meta.config.welcomeNotification,
path: path,
nid: 'welcome_' + uid
}, function(err, notification) {
if (!err && notification) {
notifications.push(notification, [uid]);
}
});
};
UserNotifications.pushCount = function(uid) {
var websockets = require('./../socket.io');
UserNotifications.getUnreadCount(uid, function(err, count) {