Download your own story attachments. Hydrate story replies on receive
This commit is contained in:
parent
269d170275
commit
5b6874b882
2 changed files with 12 additions and 1 deletions
|
@ -81,6 +81,7 @@ import { handleMessageSend } from '../util/handleMessageSend';
|
||||||
import { getSendOptions } from '../util/getSendOptions';
|
import { getSendOptions } from '../util/getSendOptions';
|
||||||
import { findAndFormatContact } from '../util/findAndFormatContact';
|
import { findAndFormatContact } from '../util/findAndFormatContact';
|
||||||
import {
|
import {
|
||||||
|
getAttachmentsForMessage,
|
||||||
getMessagePropStatus,
|
getMessagePropStatus,
|
||||||
getPropsForCallHistory,
|
getPropsForCallHistory,
|
||||||
getPropsForMessage,
|
getPropsForMessage,
|
||||||
|
@ -357,7 +358,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const attachments = message.get('attachments');
|
const attachments = getAttachmentsForMessage({ ...message.attributes });
|
||||||
|
|
||||||
this.set({
|
this.set({
|
||||||
storyReplyContext: {
|
storyReplyContext: {
|
||||||
|
@ -2444,6 +2445,10 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
storyId: dataMessage.storyId,
|
storyId: dataMessage.storyId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (storyQuote) {
|
||||||
|
await this.hydrateStoryContext(storyQuote);
|
||||||
|
}
|
||||||
|
|
||||||
const isSupported = !isUnsupportedMessage(message.attributes);
|
const isSupported = !isUnsupportedMessage(message.attributes);
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
await message.eraseContents();
|
await message.eraseContents();
|
||||||
|
|
|
@ -4,12 +4,18 @@
|
||||||
import type { ConversationAttributesType } from '../model-types.d';
|
import type { ConversationAttributesType } from '../model-types.d';
|
||||||
|
|
||||||
import dataInterface from '../sql/Client';
|
import dataInterface from '../sql/Client';
|
||||||
|
import { isMe } from './whatTypeOfConversation';
|
||||||
|
|
||||||
const MAX_NUM_STORIES_TO_PREFETCH = 5;
|
const MAX_NUM_STORIES_TO_PREFETCH = 5;
|
||||||
|
|
||||||
export async function shouldDownloadStory(
|
export async function shouldDownloadStory(
|
||||||
conversation: ConversationAttributesType
|
conversation: ConversationAttributesType
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
|
if (isMe(conversation)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We download the first time the user has posted a story
|
||||||
if (!conversation.hasPostedStory) {
|
if (!conversation.hasPostedStory) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue