call posts.relativeToAbsolute when needed

v1.18.x
barisusakli 9 years ago
parent 04d4fc2eca
commit f20efda911

@ -31,7 +31,6 @@ module.exports = function(Posts) {
} }
data.postData.content = translator.escape(data.postData.content); data.postData.content = translator.escape(data.postData.content);
data.postData.content = Posts.relativeToAbsolute(data.postData.content);
if (global.env === 'production' && data.postData.pid) { if (global.env === 'production' && data.postData.pid) {
cache.set(data.postData.pid, data.postData.content); 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); content = content.slice(0, current.index + 6) + absolute + content.slice(current.index + 6 + current[1].length);
} }
} catch(err) { } catch(err) {
winston.verbose(err.messsage); winston.verbose(err.messsage);
} }
} }
} }

@ -8,6 +8,7 @@ var winston = require('winston');
var db = require('../database'); var db = require('../database');
var user = require('../user'); var user = require('../user');
var posts = require('../posts');
var notifications = require('../notifications'); var notifications = require('../notifications');
var privileges = require('../privileges'); var privileges = require('../privileges');
var meta = require('../meta'); var meta = require('../meta');
@ -194,6 +195,8 @@ module.exports = function(Topics) {
titleEscaped = title.replace(/%/g, '%').replace(/,/g, ','); titleEscaped = title.replace(/%/g, '%').replace(/,/g, ',');
} }
postData.content = posts.relativeToAbsolute(postData.content);
notifications.create({ notifications.create({
bodyShort: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]', bodyShort: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]',
bodyLong: postData.content, bodyLong: postData.content,
@ -223,6 +226,7 @@ module.exports = function(Topics) {
if (err) { if (err) {
return next(err); return next(err);
} }
if (data.userSettings.sendPostNotifications) { if (data.userSettings.sendPostNotifications) {
emailer.send('notif_post', toUid, { emailer.send('notif_post', toUid, {
pid: postData.pid, pid: postData.pid,

Loading…
Cancel
Save