Node.js based forum software built for the modern web
merge
barisusakli931d46fe7e5e
diff --cc src/socket.io/user.jsindex e0f536e085,5597a03b3a..6b9766fea0--- a/src/socket.io/user.js+++ b/src/socket.io/user.js@@@ -5,9 -4,9 +5,10 @@@ var async = require('async')user = require('../user'),groups = require('../groups'),topics = require('../topics'),+ notifications = require('../notifications'),messaging = require('../messaging'),- utils = require('../../public/src/utils'),+ plugins = require('../plugins'),+ utils = require('./../../public/src/utils'),meta = require('../meta'),SocketUser = {};@@@ -163,29 -162,7 +164,29 @@@ SocketUser.changePicture = function(socSocketUser.follow = function(socket, data, callback) {if (socket.uid && data) {- user.follow(socket.uid, data.uid, function(err) {- toggleFollow('follow', socket.uid, data.uid, callback);++ toggleFollow('follow', socket.uid, data.uid, function(err) {+ if (err) {+ return callback(err);+ }++ user.getUserFields(socket.uid, ['username', 'userslug'], function(err, userData) {+ if (err) {+ return callback(err);+ }++ notifications.create({+ bodyShort: '[[notifications:user_started_following_you, ' + userData.username + ']]',+ path: nconf.get('relative_path') + '/user/' + userData.userslug,+ uniqueId: 'follow:uid:' + socket.uid,+ from: socket.uid+ }, function(err, nid) {+ if (!err) {+ notifications.push(nid, [data.uid]);+ }+ callback(err);+ });+ });+ });}};