resolved #1372 -- username clashes will now cause a random # to be appended to the username

This commit is contained in:
Julian Lam
2014-04-15 00:17:35 -04:00
parent f892a6793a
commit 4c9ea62c0d
3 changed files with 56 additions and 8 deletions

View File

@@ -3,11 +3,13 @@
var async = require('async'),
winston = require('winston'),
cron = require('cron').CronJob,
nconf = require('nconf'),
db = require('./database'),
utils = require('../public/src/utils'),
events = require('./events'),
User = require('./user');
User = require('./user'),
meta = require('./meta');
(function(Notifications) {
@@ -29,14 +31,22 @@ var async = require('async'),
if (exists) {
db.sortedSetRank('uid:' + uid + ':notifications:read', nid, function(err, rank) {
db.getObjectFields('notifications:' + nid, ['nid', 'from', 'text', 'importance', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
db.getObjectFields('notifications:' + nid, ['nid', 'from', 'text', 'image', 'importance', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
notification.read = rank !== null ? true:false;
if (notification.from) {
if (notification.from && !notification.image) {
User.getUserField(notification.from, 'picture', function(err, picture) {
notification.image = picture;
callback(notification);
});
} else if (notification.image) {
switch(notification.image) {
case 'brand:logo':
notification.image = meta.config['brand:logo'] || nconf.get('relative_path') + '/logo.png';
break;
}
callback(notification);
} else {
callback(notification);
}