Skip to content

Commit

Permalink
Merge pull request #64 from BenLubar/topic-title-truncated
Browse files Browse the repository at this point in the history
fix notifications that contain topic titles with commas in them
  • Loading branch information
barisusakli committed Mar 21, 2016
2 parents 462f252 + 6f3bb64 commit dbda03d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var async = module.parent.require('async'),
S = module.parent.require('string'),
XRegExp = module.parent.require('xregexp'),
validator = module.parent.require('validator'),

Expand Down Expand Up @@ -107,8 +108,11 @@ Mentions.notify = function(postData) {
return;
}

var title = S(results.topic.title).decodeHTMLEntities().s;
var titleEscaped = title.replace(/%/g, '%').replace(/,/g, ',');

Notifications.create({
bodyShort: '[[mentions:user_mentioned_you_in, ' + results.author + ', ' + results.topic.title + ']]',
bodyShort: '[[mentions:user_mentioned_you_in, ' + results.author + ', ' + titleEscaped + ']]',
bodyLong: postData.content,
nid: 'tid:' + postData.tid + ':pid:' + postData.pid + ':uid:' + postData.uid,
pid: postData.pid,
Expand Down

0 comments on commit dbda03d

Please sign in to comment.