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'),
statusIcon: function() {
var desc;
var name = Handlebars.Utils.escapeExpression(this.get('name')),
desc;
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>';
}
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 null;

View File

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

View File

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