FIX: Escape name on activity feed

This commit is contained in:
Robin Ward 2014-04-03 11:54:51 -04:00
parent 10d0320532
commit faa341148e
3 changed files with 26 additions and 23 deletions

View File

@ -75,13 +75,15 @@ Discourse.User = Discourse.Model.extend({
}.property('profile_background'), }.property('profile_background'),
statusIcon: function() { statusIcon: function() {
var desc; var name = Handlebars.Utils.escapeExpression(this.get('name')),
desc;
if(this.get('admin')) { if(this.get('admin')) {
desc = I18n.t('user.admin', {user: this.get("name")}); desc = I18n.t('user.admin', {user: name});
return '<i class="fa fa-trophy" title="' + desc + '" alt="' + desc + '"></i>'; return '<i class="fa fa-trophy" title="' + desc + '" alt="' + desc + '"></i>';
} }
if(this.get('moderator')){ if(this.get('moderator')){
desc = I18n.t('user.moderator', {user: this.get("name")}); desc = I18n.t('user.moderator', {user: name});
return '<i class="fa fa-magic" title="' + desc + '" alt="' + desc + '"></i>'; return '<i class="fa fa-magic" title="' + desc + '" alt="' + desc + '"></i>';
} }
return null; return null;

View File

@ -8,21 +8,22 @@
**/ **/
var UserActionTypes = { var UserActionTypes = {
likes_given: 1, likes_given: 1,
likes_received: 2, likes_received: 2,
bookmarks: 3, bookmarks: 3,
topics: 4, topics: 4,
posts: 5, posts: 5,
replies: 6, replies: 6,
mentions: 7, mentions: 7,
quotes: 9, quotes: 9,
starred: 10, starred: 10,
edits: 11, edits: 11,
messages_sent: 12, messages_sent: 12,
messages_received: 13 messages_received: 13
}; },
esc = Handlebars.Utils.escapeExpression,
InvertedActionTypes = {};
var InvertedActionTypes = {};
_.each(UserActionTypes, function (k, v) { _.each(UserActionTypes, function (k, v) {
InvertedActionTypes[k] = v; InvertedActionTypes[k] = v;
}); });
@ -81,11 +82,11 @@ Discourse.UserAction = Discourse.Model.extend({
replyUrl: this.get('replyUrl'), replyUrl: this.get('replyUrl'),
postUrl: this.get('postUrl'), postUrl: this.get('postUrl'),
topicUrl: this.get('replyUrl'), topicUrl: this.get('replyUrl'),
user: this.get('presentName'), user: esc(this.get('presentName')),
post_number: '#' + this.get('reply_to_post_number'), post_number: '#' + this.get('reply_to_post_number'),
user1Url: this.get('userUrl'), user1Url: this.get('userUrl'),
user2Url: this.get('targetUserUrl'), user2Url: this.get('targetUserUrl'),
another_user: this.get('targetDisplayName') another_user: esc(this.get('targetDisplayName'))
})); }));
}.property('descriptionKey'), }.property('descriptionKey'),

View File

@ -14,13 +14,13 @@ Discourse.UserStreamView = Discourse.View.extend(Discourse.LoadMore, {
actions: { actions: {
loadMore: function() { loadMore: function() {
var userStreamView = this; var self = this;
if (userStreamView.get('loading')) { return; } if (this.get('loading')) { return; }
var stream = this.get('controller.model'); var stream = this.get('controller.model');
stream.findItems().then(function() { stream.findItems().then(function() {
userStreamView.set('loading', false); self.set('loading', false);
userStreamView.get('eyeline').flushRest(); self.get('eyeline').flushRest();
}); });
} }
} }