refactor user.create

dont fire filter:user.create if there userData is invalid
This commit is contained in:
barisusakli
2014-10-28 18:28:26 -04:00
parent bce96d04c7
commit 5be1c17aa7
2 changed files with 165 additions and 134 deletions

View File

@@ -280,6 +280,19 @@ var async = require('async'),
});
};
UserNotifications.sendNameChangeNotification = function(uid, username) {
notifications.create({
bodyShort: '[[user:username_taken_workaround, ' + username + ']]',
image: 'brand:logo',
nid: 'username_taken:' + uid,
datetime: Date.now()
}, 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) {