mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
closes #1989
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
"user_flagged_post": "<strong>%1</strong> flagged a post.",
|
||||
"user_posted_to" : "<strong>%1</strong> has posted a reply to: <strong>%2</strong>",
|
||||
"user_mentioned_you_in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
|
||||
"user_started_following_you": "<strong>%1</strong> started following you.",
|
||||
|
||||
"email-confirmed": "Email Confirmed",
|
||||
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var async = require('async'),
|
||||
nconf = require('nconf'),
|
||||
user = require('../user'),
|
||||
groups = require('../groups'),
|
||||
topics = require('../topics'),
|
||||
notifications = require('../notifications'),
|
||||
messaging = require('../messaging'),
|
||||
utils = require('./../../public/src/utils'),
|
||||
utils = require('../../public/src/utils'),
|
||||
meta = require('../meta'),
|
||||
SocketUser = {};
|
||||
|
||||
@@ -159,7 +161,29 @@ SocketUser.changePicture = function(socket, data, callback) {
|
||||
|
||||
SocketUser.follow = function(socket, data, callback) {
|
||||
if (socket.uid && data) {
|
||||
user.follow(socket.uid, data.uid, callback);
|
||||
user.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);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user