merge conflict resolved
This commit is contained in:
@@ -403,15 +403,25 @@ class MessagesView extends React.Component {
|
||||
this.setState({topic: ctrl.topic});
|
||||
}
|
||||
this.props.onNewTopicCreated(this.props.topic, ctrl.topic);
|
||||
// If there are unsent messages, try sending them now.
|
||||
// If there are unsent messages (except video call messages),
|
||||
// try sending them now. Unsent video call messages will be dropped.
|
||||
let calls = [];
|
||||
topic.queuedMessages((pub) => {
|
||||
if (pub._sending) {
|
||||
return;
|
||||
}
|
||||
if (pub.head && pub.head.webrtc) {
|
||||
// Filter out unsent video call messages.
|
||||
calls.push(pub.seq);
|
||||
return;
|
||||
}
|
||||
if (topic.isSubscribed()) {
|
||||
this.retrySend(pub);
|
||||
}
|
||||
});
|
||||
if (calls.length > 0) {
|
||||
topic.delMessagesList(calls, true);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Failed subscription to", this.state.topic, err);
|
||||
@@ -760,7 +770,12 @@ class MessagesView extends React.Component {
|
||||
|
||||
// Retry sending a message.
|
||||
retrySend(pub) {
|
||||
this.props.sendMessage(pub.content, undefined, undefined, pub.head);
|
||||
this.props.sendMessage(pub.content, undefined, undefined, pub.head)
|
||||
.then(() => {
|
||||
// All good. Remove the original message draft from the cache.
|
||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||
topic.delMessagesList([pub.seq], true);
|
||||
});
|
||||
}
|
||||
|
||||
// Send attachment as Drafty message:
|
||||
|
||||
@@ -1007,15 +1007,25 @@ class TinodeWeb extends React.Component {
|
||||
const subscribePromise =
|
||||
topic.subscribe()
|
||||
.then(() => {
|
||||
// If there are unsent messages, try sending them now.
|
||||
// If there are unsent messages (except video call messages),
|
||||
// try sending them now. Unsent video call messages will be dropped.
|
||||
let calls = [];
|
||||
topic.queuedMessages(pub => {
|
||||
if (pub._sending || pub.seq == msg.seq) {
|
||||
return;
|
||||
}
|
||||
if (pub.head && pub.head.webrtc) {
|
||||
// Filter out unsent video call messages.
|
||||
calls.push(pub.seq);
|
||||
return;
|
||||
}
|
||||
if (topic.isSubscribed()) {
|
||||
topic.publishMessage(pub);
|
||||
}
|
||||
});
|
||||
if (calls.length > 0) {
|
||||
topic.delMessagesList(calls, true);
|
||||
}
|
||||
});
|
||||
completion.push(subscribePromise);
|
||||
}
|
||||
|
||||
+24
-1
@@ -5855,15 +5855,25 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
||||
}
|
||||
|
||||
this.props.onNewTopicCreated(this.props.topic, ctrl.topic);
|
||||
let calls = [];
|
||||
topic.queuedMessages(pub => {
|
||||
if (pub._sending) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pub.head && pub.head.webrtc) {
|
||||
calls.push(pub.seq);
|
||||
return;
|
||||
}
|
||||
|
||||
if (topic.isSubscribed()) {
|
||||
this.retrySend(pub);
|
||||
}
|
||||
});
|
||||
|
||||
if (calls.length > 0) {
|
||||
topic.delMessagesList(calls, true);
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error("Failed subscription to", this.state.topic, err);
|
||||
this.props.onError(err.message, 'err');
|
||||
@@ -6245,7 +6255,10 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
||||
}
|
||||
|
||||
retrySend(pub) {
|
||||
this.props.sendMessage(pub.content, undefined, undefined, pub.head);
|
||||
this.props.sendMessage(pub.content, undefined, undefined, pub.head).then(() => {
|
||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||
topic.delMessagesList([pub.seq], true);
|
||||
});
|
||||
}
|
||||
|
||||
sendFileAttachment(file) {
|
||||
@@ -8586,15 +8599,25 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
||||
|
||||
if (!topic.isSubscribed()) {
|
||||
const subscribePromise = topic.subscribe().then(() => {
|
||||
let calls = [];
|
||||
topic.queuedMessages(pub => {
|
||||
if (pub._sending || pub.seq == msg.seq) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pub.head && pub.head.webrtc) {
|
||||
calls.push(pub.seq);
|
||||
return;
|
||||
}
|
||||
|
||||
if (topic.isSubscribed()) {
|
||||
topic.publishMessage(pub);
|
||||
}
|
||||
});
|
||||
|
||||
if (calls.length > 0) {
|
||||
topic.delMessagesList(calls, true);
|
||||
}
|
||||
});
|
||||
completion.push(subscribePromise);
|
||||
}
|
||||
|
||||
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
Reference in New Issue
Block a user