Fix attachments not loading for stickers/long messages
This commit is contained in:
parent
d7ec22fb0b
commit
6fec6b2646
2 changed files with 28 additions and 2 deletions
|
@ -2102,7 +2102,10 @@ export async function startApp(): Promise<void> {
|
||||||
const attachmentsToDownload = attachmentDownloadQueue.filter(
|
const attachmentsToDownload = attachmentDownloadQueue.filter(
|
||||||
(message, index) =>
|
(message, index) =>
|
||||||
index <= MAX_ATTACHMENT_MSGS_TO_DOWNLOAD ||
|
index <= MAX_ATTACHMENT_MSGS_TO_DOWNLOAD ||
|
||||||
message.getReceivedAt() < THREE_DAYS_AGO
|
message.getReceivedAt() > THREE_DAYS_AGO ||
|
||||||
|
// Stickers and long text attachments has to be downloaded for UI
|
||||||
|
// to display the message properly.
|
||||||
|
message.hasRequiredAttachmentDownloads()
|
||||||
);
|
);
|
||||||
window.log.info(
|
window.log.info(
|
||||||
'Downloading recent attachments of total attachments',
|
'Downloading recent attachments of total attachments',
|
||||||
|
|
|
@ -38,7 +38,7 @@ import {
|
||||||
getCallingNotificationText,
|
getCallingNotificationText,
|
||||||
} from '../util/callingNotification';
|
} from '../util/callingNotification';
|
||||||
import { PropsType as ProfileChangeNotificationPropsType } from '../components/conversation/ProfileChangeNotification';
|
import { PropsType as ProfileChangeNotificationPropsType } from '../components/conversation/ProfileChangeNotification';
|
||||||
import { isImage, isVideo } from '../types/Attachment';
|
import { AttachmentType, isImage, isVideo } from '../types/Attachment';
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
/* eslint-disable more/no-then */
|
/* eslint-disable more/no-then */
|
||||||
|
@ -2598,6 +2598,29 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
return this.syncPromise;
|
return this.syncPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasRequiredAttachmentDownloads(): boolean {
|
||||||
|
const attachments: ReadonlyArray<AttachmentType> =
|
||||||
|
this.get('attachments') || [];
|
||||||
|
|
||||||
|
const hasLongMessageAttachments = attachments.some(attachment => {
|
||||||
|
return (
|
||||||
|
attachment.contentType ===
|
||||||
|
window.Whisper.Message.LONG_MESSAGE_CONTENT_TYPE
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (hasLongMessageAttachments) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sticker = this.get('sticker');
|
||||||
|
if (sticker) {
|
||||||
|
return !sticker.data || !sticker.data.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: If you're modifying this function then you'll likely also need
|
// NOTE: If you're modifying this function then you'll likely also need
|
||||||
// to modify queueAttachmentDownloads since it contains the logic below
|
// to modify queueAttachmentDownloads since it contains the logic below
|
||||||
hasAttachmentDownloads(): boolean {
|
hasAttachmentDownloads(): boolean {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue