summaryrefslogtreecommitdiffstats
path: root/apps/comments/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-02-01 16:54:27 +0100
committerVincent Petry <pvince81@owncloud.com>2016-02-02 18:01:15 +0100
commit3a6d065e503def8e9ca47dd6780b9ddbc0772509 (patch)
tree8bf8c4abb3708d33bc2021d581cdc64913cc23ad /apps/comments/js
parent64ad99db70a18bafdbcf906dd400db6e0712fe29 (diff)
downloadnextcloud-server-3a6d065e503def8e9ca47dd6780b9ddbc0772509.tar.gz
nextcloud-server-3a6d065e503def8e9ca47dd6780b9ddbc0772509.zip
Fix formatting messages with newlines
Diffstat (limited to 'apps/comments/js')
-rw-r--r--apps/comments/js/commentstabview.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js
index c2fa08ed20e..bc496f2e599 100644
--- a/apps/comments/js/commentstabview.js
+++ b/apps/comments/js/commentstabview.js
@@ -38,7 +38,7 @@
' <div class="author">{{actorDisplayName}}</div>' +
' <div class="date has-tooltip" title="{{altDate}}">{{date}}</div>' +
' </div>' +
- ' <div class="message">{{message}}</div>' +
+ ' <div class="message">{{{formattedMessage}}}</div>' +
'</li>';
/**
@@ -122,7 +122,8 @@
var timestamp = new Date(commentModel.get('creationDateTime')).getTime();
var data = _.extend({
date: OC.Util.relativeModifiedDate(timestamp),
- altDate: OC.Util.formatDate(timestamp)
+ altDate: OC.Util.formatDate(timestamp),
+ formattedMessage: this._formatMessage(commentModel.get('message'))
}, commentModel.attributes);
// TODO: format
return data;
@@ -165,6 +166,14 @@
}
},
+ /**
+ * Convert a message to be displayed in HTML,
+ * converts newlines to <br> tags.
+ */
+ _formatMessage: function(message) {
+ return escapeHTML(message).replace(/\n/g, '<br/>');
+ },
+
nextPage: function() {
if (this._loading || !this.collection.hasMoreResults()) {
return;