prevent double sound
This commit is contained in:
parent
1a69b0faf4
commit
ac762e0056
2 changed files with 3 additions and 3 deletions
|
@ -109,7 +109,7 @@ Metamaps.Views.chatView = (function () {
|
||||||
this.$unread.html(this.unreadMessages);
|
this.$unread.html(this.unreadMessages);
|
||||||
this.$unread.show();
|
this.$unread.show();
|
||||||
},
|
},
|
||||||
addMessage: function(message, isInitial, wasMe) {
|
addMessage: function(message, isInitial) {
|
||||||
|
|
||||||
if (!this.isOpen && !isInitial) Private.incrementUnread.call(this);
|
if (!this.isOpen && !isInitial) Private.incrementUnread.call(this);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ Metamaps.Views.chatView = (function () {
|
||||||
this.$messages.append($html);
|
this.$messages.append($html);
|
||||||
if (!isInitial) this.scrollMessages(200);
|
if (!isInitial) this.scrollMessages(200);
|
||||||
|
|
||||||
if (!isInitial && this.alertSound && !wasMe) this.sound.play('receivechat');
|
if (!isInitial && this.alertSound) this.sound.play('receivechat');
|
||||||
},
|
},
|
||||||
initialMessages: function() {
|
initialMessages: function() {
|
||||||
var messages = this.messages.models;
|
var messages = this.messages.models;
|
||||||
|
|
|
@ -164,7 +164,7 @@ Metamaps.Views.room = (function () {
|
||||||
});
|
});
|
||||||
m.save(null, {
|
m.save(null, {
|
||||||
success: function (model, response) {
|
success: function (model, response) {
|
||||||
self.addMessages(new Metamaps.Backbone.MessageCollection(model));
|
self.addMessages(new Metamaps.Backbone.MessageCollection(model), true);
|
||||||
$(document).trigger(room.events.newMessage, [model]);
|
$(document).trigger(room.events.newMessage, [model]);
|
||||||
},
|
},
|
||||||
error: function (model, response) {
|
error: function (model, response) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue