make sure unread is > 0 before playing a sound
This commit is contained in:
@@ -557,7 +557,8 @@ class TinodeWeb extends React.Component {
|
|||||||
const topic = this.tinode.getTopic(cont.topic);
|
const topic = this.tinode.getTopic(cont.topic);
|
||||||
const archived = topic && topic.isArchived();
|
const archived = topic && topic.isArchived();
|
||||||
|
|
||||||
// New message received
|
// New message received. Maybe the message is from the current user, then unread is 0.
|
||||||
|
if (cont.unread > 0) {
|
||||||
if (document.hidden) {
|
if (document.hidden) {
|
||||||
if (this.state.messageSounds && !archived) {
|
if (this.state.messageSounds && !archived) {
|
||||||
POP_SOUND.play();
|
POP_SOUND.play();
|
||||||
@@ -571,6 +572,7 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
this.resetContactList();
|
this.resetContactList();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (what == 'recv') {
|
} else if (what == 'recv') {
|
||||||
// Explicitly ignoring "recv" -- it causes no visible updates to contact list.
|
// Explicitly ignoring "recv" -- it causes no visible updates to contact list.
|
||||||
} else if (what == 'gone' || what == 'unsub') {
|
} else if (what == 'gone' || what == 'unsub') {
|
||||||
|
|||||||
@@ -4948,6 +4948,7 @@ var TinodeWeb = function (_React$Component) {
|
|||||||
var topic = this.tinode.getTopic(cont.topic);
|
var topic = this.tinode.getTopic(cont.topic);
|
||||||
var archived = topic && topic.isArchived();
|
var archived = topic && topic.isArchived();
|
||||||
|
|
||||||
|
if (cont.unread > 0) {
|
||||||
if (document.hidden) {
|
if (document.hidden) {
|
||||||
if (this.state.messageSounds && !archived) {
|
if (this.state.messageSounds && !archived) {
|
||||||
POP_SOUND.play();
|
POP_SOUND.play();
|
||||||
@@ -4961,6 +4962,7 @@ var TinodeWeb = function (_React$Component) {
|
|||||||
|
|
||||||
this.resetContactList();
|
this.resetContactList();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (what == 'recv') {} else if (what == 'gone' || what == 'unsub') {
|
} else if (what == 'recv') {} else if (what == 'gone' || what == 'unsub') {
|
||||||
if (this.state.topicSelected == cont.topic) {
|
if (this.state.topicSelected == cont.topic) {
|
||||||
this.handleTopicSelected(null);
|
this.handleTopicSelected(null);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6
-2
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user