From f20efda91134b75e52ba93e69fba485bfdedc473 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 29 Jun 2016 21:09:05 +0300 Subject: [PATCH] call posts.relativeToAbsolute when needed --- src/posts/parse.js | 5 ++--- src/topics/follow.js | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/posts/parse.js b/src/posts/parse.js index 087146e77d..19e6430681 100644 --- a/src/posts/parse.js +++ b/src/posts/parse.js @@ -31,7 +31,6 @@ module.exports = function(Posts) { } data.postData.content = translator.escape(data.postData.content); - data.postData.content = Posts.relativeToAbsolute(data.postData.content); if (global.env === 'production' && data.postData.pid) { cache.set(data.postData.pid, data.postData.content); @@ -67,8 +66,8 @@ module.exports = function(Posts) { content = content.slice(0, current.index + 6) + absolute + content.slice(current.index + 6 + current[1].length); } } catch(err) { - winston.verbose(err.messsage); - } + winston.verbose(err.messsage); + } } } diff --git a/src/topics/follow.js b/src/topics/follow.js index c0cb715c9d..e74d85d23c 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -8,6 +8,7 @@ var winston = require('winston'); var db = require('../database'); var user = require('../user'); +var posts = require('../posts'); var notifications = require('../notifications'); var privileges = require('../privileges'); var meta = require('../meta'); @@ -194,6 +195,8 @@ module.exports = function(Topics) { titleEscaped = title.replace(/%/g, '%').replace(/,/g, ','); } + postData.content = posts.relativeToAbsolute(postData.content); + notifications.create({ bodyShort: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]', bodyLong: postData.content, @@ -223,6 +226,7 @@ module.exports = function(Topics) { if (err) { return next(err); } + if (data.userSettings.sendPostNotifications) { emailer.send('notif_post', toUid, { pid: postData.pid,