Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Fauntleroy/relay.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Fauntleroy committed Jan 14, 2014
2 parents 4c1da88 + 45129b0 commit eb17096
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion assets/scripts/models/channel.js
Expand Up @@ -49,7 +49,7 @@ module.exports = Backbone.Model.extend({
this.destroy();
},
doAddMessage: function( message ){
if( this.get('active') ) this.mediator.trigger( 'active:messages:add', message );
if( this.get('active') ) this.mediator.trigger( 'active:messages:add', message.toJSON() );
if( !this.get('active') && message.get('message') ){
var unread = this.get('unread');
this.set( 'unread', unread + 1 );
Expand Down
8 changes: 5 additions & 3 deletions assets/scripts/models/title.js
Expand Up @@ -11,16 +11,18 @@ module.exports = Backbone.Model.extend({
initialize: function( data, mediator ){
_( this ).bindAll( 'updateVisibility', 'clearUnread' );
this.mediator = mediator;
this.listenTo( this.mediator, 'chat:active:message', this.updateUnread );
this.listenTo( this.mediator, 'active:messages:add', this.updateUnread );
this.listenTo( this.mediator, 'channels:active', this.updateChannel );
Visibility.change( this.updateVisibility );
},
isHidden: function(){
return Visibility.hidden();
},
updateUnread: function(){
// update unread message count
// only updates for 'message' type messages now
updateUnread: function( message ){
if( !this.isHidden() ) return;
this.set( 'unread', this.get('unread') + 1 );
if( message.message ) this.set( 'unread', this.get('unread') + 1 );
},
updateChannel: function( channel ){
this.set( 'channel', channel );
Expand Down
2 changes: 1 addition & 1 deletion lib/server.js
Expand Up @@ -79,7 +79,7 @@ module.exports = function( config ){

try {

var preset_server = ( config.defaults.locked )? config.defaults.server: {};
var preset_server = ( config.defaults.server.locked )? config.defaults.server: {};

irc_adapter = new Adapter({
server: preset_server.host || parameters.server,
Expand Down

0 comments on commit eb17096

Please sign in to comment.