Merge pull request #169 from Mikunj/queue-message-send-update

Minor code update
pull/182/head
sachaaaaa 6 years ago committed by GitHub
commit 1519406c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -723,7 +723,7 @@
<script type='text/javascript' src='js/models/blockedNumbers.js'></script>
<script type='text/javascript' src='js/models/profile.js'></script>
<script type='text/javascript' src='js/expiring_messages.js'></script>
<script type='text/javascript' src='js/queue_manager.js'></script>
<script type='text/javascript' src='js/job_queue.js'></script>
<script type='text/javascript' src='js/chromium.js'></script>
<script type='text/javascript' src='js/registration.js'></script>

@ -8,6 +8,7 @@
/* global textsecure: false */
/* global Whisper: false */
/* global lokiP2pAPI: false */
/* global JobQueue: false */
/* eslint-disable more/no-then */
@ -160,6 +161,8 @@
// Online status handling
this.set({ isOnline: lokiP2pAPI.isOnline(this.id) });
this.messageSendQueue = new JobQueue();
},
isMe() {
@ -1010,23 +1013,12 @@
},
queueMessageSend(callback) {
const previous = this.pendingSend || Promise.resolve();
const taskWithTimeout = textsecure.createTaskWithTimeout(
callback,
`conversation ${this.idForLogging()}`
);
this.pendingSend = previous.then(taskWithTimeout, taskWithTimeout);
const current = this.pendingSend;
current.then(() => {
if (this.pendingSend === current) {
delete this.pendingSend;
}
});
return current;
return this.messageSendQueue.add(taskWithTimeout);
},
getRecipients() {

@ -373,6 +373,7 @@
<script type='text/javascript' src='../js/expiring_messages.js' data-cover></script>
<script type='text/javascript' src='../js/notifications.js' data-cover></script>
<script type='text/javascript' src='../js/focus_listener.js'></script>
<script type='text/javascript' src='../js/job_queue.js'></script>
<script type="text/javascript" src="../js/chromium.js" data-cover></script>

Loading…
Cancel
Save