diff --git a/package.json b/package.json index c3e69e23d8..abeae7daf6 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "3.0.15", - "nodebb-theme-persona": "4.1.84", + "nodebb-theme-persona": "4.1.85", "nodebb-theme-vanilla": "5.1.55", "nodebb-widget-essentials": "2.0.13", "nodemailer": "2.6.4", diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json index fd6f11e250..f0cb35f615 100644 --- a/public/language/en_GB/user.json +++ b/public/language/en_GB/user.json @@ -33,7 +33,8 @@ "signature": "Signature", "birthday": "Birthday", "chat": "Chat", - "chat_with": "Chat with %1", + "chat_with": "Continue chat with %1", + "new_chat_with": "Start new chat with %1", "follow": "Follow", "unfollow": "Unfollow", "more": "More", diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js index 1b16aec4b1..d225e2cae1 100644 --- a/public/src/client/account/header.js +++ b/public/src/client/account/header.js @@ -41,6 +41,11 @@ define('forum/account/header', [ }); }); + components.get('account/new-chat').on('click', function () { + app.newChat(ajaxify.data.uid); + }); + + components.get('account/ban').on('click', banAccount); components.get('account/unban').on('click', unbanAccount); components.get('account/delete').on('click', deleteAccount); diff --git a/src/controllers/accounts/profile.js b/src/controllers/accounts/profile.js index 8ee8979b43..6bbaced751 100644 --- a/src/controllers/accounts/profile.js +++ b/src/controllers/accounts/profile.js @@ -11,6 +11,7 @@ var meta = require('../../meta'); var accountHelpers = require('./helpers'); var helpers = require('../helpers'); var pagination = require('../../pagination'); +var messaging = require('../../messaging'); var profileController = {}; @@ -46,8 +47,8 @@ profileController.get = function (req, res, callback) { } async.parallel({ - isFollowing: function (next) { - user.isFollowing(req.uid, userData.theirid, next); + hasPrivateChat: function (next) { + messaging.hasPrivateChat(req.uid, userData.uid, next); }, posts: function (next) { posts.getPostSummariesFromSet('uid:' + userData.theirid + ':posts', req.uid, start, stop, next); @@ -72,10 +73,9 @@ profileController.get = function (req, res, callback) { userData.posts = results.posts.posts.filter(function (p) { return p && parseInt(p.deleted, 10) !== 1; }); - + userData.hasPrivateChat = results.hasPrivateChat; userData.aboutme = results.aboutme; userData.nextStart = results.posts.nextStart; - userData.isFollowing = results.isFollowing; userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username}]); userData.title = userData.username; var pageCount = Math.ceil(userData.postcount / itemsPerPage); diff --git a/src/messaging.js b/src/messaging.js index d69e70b000..494a354da0 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -444,6 +444,9 @@ var userNotifications = require('./user/notifications'); }; Messaging.hasPrivateChat = function (uid, withUid, callback) { + if (parseInt(uid, 10) === parseInt(withUid, 10)) { + return callback(null, 0); + } async.waterfall([ function (next) { async.parallel({