Fixed a couple of bugs

Fixed a bug where reacting to an incoming attachment message in a one-to-one conversation would result in the attachment being re-uploaded
Fixed a bug where concurrent queues in the JobRunner wouldn't start newly added jobs until current jobs had finished executing
pull/858/head
Morgan Pretty 1 year ago
parent 2035d508d9
commit 37894175e5

@ -31,7 +31,16 @@ public enum MessageSendJob: JobExecutor {
// so extract them from any associated attachments
var messageFileIds: [String] = []
if details.message is VisibleMessage {
/// Ensure any associated attachments have already been uploaded before sending the message
///
/// **Note:** Reactions reference their original message so we need to ignore this logic for reaction messages to ensure we don't
/// incorrectly re-upload incoming attachments that the user reacted to, we also want to exclude "sync" messages since they should
/// already have attachments in a valid state
if
details.message is VisibleMessage,
(details.message as? VisibleMessage)?.reaction == nil &&
details.isSyncMessage == false
{
guard
let jobId: Int64 = job.id,
let interactionId: Int64 = job.interactionId

@ -528,6 +528,11 @@ private final class JobQueue {
}
queue.mutate { $0.append(job) }
// If this is a concurrent queue then we should immediately start the next job
guard executionType == .concurrent else { return }
runNextJob()
}
/// Upsert a job onto the queue, if the queue isn't currently running and 'canStartJob' is true then this will start

Loading…
Cancel
Save