[Common] Bug in rendering chat and header panel when user id contains special characters.
This commit is contained in:
parent
d04a61933e
commit
1b75d2035e
|
@ -40,15 +40,22 @@
|
|||
*
|
||||
*/
|
||||
|
||||
define([
|
||||
'backbone'
|
||||
], function(Backbone){
|
||||
'use strict';
|
||||
if (Common === undefined)
|
||||
var Common = {};
|
||||
|
||||
Common.Models = Common.Models || {};
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common/main/lib/component/BaseView'
|
||||
], function(_, Backbone){
|
||||
'use strict';
|
||||
|
||||
Common.Models.User = Backbone.Model.extend({
|
||||
defaults: {
|
||||
defaults: function() {
|
||||
return {
|
||||
iid : Common.UI.getId(), // internal id for rendering
|
||||
id : undefined,
|
||||
username : 'Guest',
|
||||
color : '#fff',
|
||||
|
@ -56,5 +63,6 @@ define([
|
|||
online : false,
|
||||
view : false
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -59,7 +59,7 @@ define([
|
|||
storeUsers: undefined,
|
||||
storeMessages: undefined,
|
||||
|
||||
tplUser: ['<li id="chat-user-<%= user.get("id") %>"<% if (!user.get("online")) { %> class="offline"<% } %>>',
|
||||
tplUser: ['<li id="<%= user.get("iid") %>"<% if (!user.get("online")) { %> class="offline"<% } %>>',
|
||||
'<div class="color" style="background-color: <%= user.get("color") %>;" >',
|
||||
'<label class="name"><%= scope.getUserName(user.get("username")) %></label>',
|
||||
'</div>',
|
||||
|
@ -169,7 +169,7 @@ define([
|
|||
|
||||
_onUsersChanged: function(m) {
|
||||
if (m.changed.online != undefined && this.panelUsers) {
|
||||
this.panelUsers.find('#chat-user-'+ m.get('id'))[m.changed.online?'removeClass':'addClass']('offline');
|
||||
this.panelUsers.find('#' + m.get('iid'))[m.changed.online?'removeClass':'addClass']('offline');
|
||||
this.panelUsers.scroller.update({minScrollbarLength : 25, alwaysVisibleY: true});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -56,7 +56,7 @@ define([
|
|||
var $saveStatus;
|
||||
|
||||
var templateUserItem =
|
||||
'<li id="status-chat-user-<%= user.get("id") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">' +
|
||||
'<li id="<%= user.get("iid") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">' +
|
||||
'<div class="color" style="background-color: <%= user.get("color") %>;" >' +
|
||||
'<label class="name"><%= fnEncode(user.get("username")) %></label>' +
|
||||
'</div>' +
|
||||
|
@ -127,7 +127,7 @@ define([
|
|||
|
||||
function onUsersChanged(model, collection) {
|
||||
if (model.changed.online != undefined && $userList) {
|
||||
$userList.find('#status-chat-user-'+ model.get('id'))[model.changed.online ? 'removeClass' : 'addClass']('offline');
|
||||
$userList.find('#'+ model.get('iid'))[model.changed.online ? 'removeClass' : 'addClass']('offline');
|
||||
$userList.scroller && $userList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue