use topic.latestMsgVersion instead of iteration over versions

This commit is contained in:
or-else
2022-06-29 10:15:57 -07:00
parent 315631f67c
commit dcf9e1d47e
7 changed files with 49 additions and 32 deletions
+5 -6
View File
@@ -1814,11 +1814,10 @@ class TinodeWeb extends React.Component {
// Check if we have a later version of the message (which means the call
// has been either accepted or finished).
let isNewCall = true;
topic.messageVersions(data, (msg) => {
if (msg.head.webrtc && msg.head.webrtc != CALL_HEAD_STARTED) {
isNewCall = false;
}
});
const msg = topic.latestMsgVersion(data.seq) || data;
if (msg.head.webrtc && msg.head.webrtc != CALL_HEAD_STARTED) {
isNewCall = false;
}
if (isNewCall) {
// This is a legit new call.
if (data.from != this.state.myUserId) {
@@ -1837,7 +1836,7 @@ class TinodeWeb extends React.Component {
}
}
} else {
console.log('Could not find topic', data.topic);
console.warn("Received vc data message from unknown topic", data.topic);
}
}
}