Fixes save in lightbox
This commit is contained in:
parent
2d16542f4d
commit
4afe4649ec
7 changed files with 40 additions and 5 deletions
|
@ -228,6 +228,7 @@
|
||||||
|
|
||||||
&--forward {
|
&--forward {
|
||||||
&::before {
|
&::before {
|
||||||
|
transform: scaleX(-1);
|
||||||
@include color-svg(
|
@include color-svg(
|
||||||
'../images/icons/v2/reply-solid-24.svg',
|
'../images/icons/v2/reply-solid-24.svg',
|
||||||
$color-gray-15
|
$color-gray-15
|
||||||
|
|
|
@ -43,6 +43,7 @@ function createMediaItem(
|
||||||
id: 'image-msg',
|
id: 'image-msg',
|
||||||
received_at: 0,
|
received_at: 0,
|
||||||
received_at_ms: Date.now(),
|
received_at_ms: Date.now(),
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
objectURL: '',
|
objectURL: '',
|
||||||
...overrideProps,
|
...overrideProps,
|
||||||
|
@ -77,6 +78,7 @@ story.add('Multimedia', () => {
|
||||||
id: 'image-msg',
|
id: 'image-msg',
|
||||||
received_at: 1,
|
received_at: 1,
|
||||||
received_at_ms: Date.now(),
|
received_at_ms: Date.now(),
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
objectURL: '/fixtures/tina-rolf-269345-unsplash.jpg',
|
objectURL: '/fixtures/tina-rolf-269345-unsplash.jpg',
|
||||||
},
|
},
|
||||||
|
@ -94,6 +96,7 @@ story.add('Multimedia', () => {
|
||||||
id: 'video-msg',
|
id: 'video-msg',
|
||||||
received_at: 2,
|
received_at: 2,
|
||||||
received_at_ms: Date.now(),
|
received_at_ms: Date.now(),
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
objectURL: '/fixtures/pixabay-Soap-Bubble-7141.mp4',
|
objectURL: '/fixtures/pixabay-Soap-Bubble-7141.mp4',
|
||||||
},
|
},
|
||||||
|
@ -132,6 +135,7 @@ story.add('Missing Media', () => {
|
||||||
id: 'image-msg',
|
id: 'image-msg',
|
||||||
received_at: 3,
|
received_at: 3,
|
||||||
received_at_ms: Date.now(),
|
received_at_ms: Date.now(),
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
objectURL: undefined,
|
objectURL: undefined,
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,6 +56,7 @@ const createRandomFile = (
|
||||||
received_at: Math.floor(Math.random() * 10),
|
received_at: Math.floor(Math.random() * 10),
|
||||||
received_at_ms: random(startTime, startTime + timeWindow),
|
received_at_ms: random(startTime, startTime + timeWindow),
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
url: '',
|
url: '',
|
||||||
|
|
|
@ -50,6 +50,7 @@ const createMediaItem = (
|
||||||
id: 'id',
|
id: 'id',
|
||||||
received_at: Date.now(),
|
received_at: Date.now(),
|
||||||
received_at_ms: Date.now(),
|
received_at_ms: Date.now(),
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ const toMediaItem = (date: Date): MediaItemType => ({
|
||||||
received_at: date.getTime(),
|
received_at: date.getTime(),
|
||||||
received_at_ms: date.getTime(),
|
received_at_ms: date.getTime(),
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -62,6 +63,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1523534400000,
|
received_at: 1523534400000,
|
||||||
received_at_ms: 1523534400000,
|
received_at_ms: 1523534400000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -78,6 +80,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1523491260000,
|
received_at: 1523491260000,
|
||||||
received_at_ms: 1523491260000,
|
received_at_ms: 1523491260000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -99,6 +102,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1523491140000,
|
received_at: 1523491140000,
|
||||||
received_at_ms: 1523491140000,
|
received_at_ms: 1523491140000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -120,6 +124,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1523232060000,
|
received_at: 1523232060000,
|
||||||
received_at_ms: 1523232060000,
|
received_at_ms: 1523232060000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -141,6 +146,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1523231940000,
|
received_at: 1523231940000,
|
||||||
received_at_ms: 1523231940000,
|
received_at_ms: 1523231940000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -157,6 +163,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1522540860000,
|
received_at: 1522540860000,
|
||||||
received_at_ms: 1522540860000,
|
received_at_ms: 1522540860000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -180,6 +187,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1522540740000,
|
received_at: 1522540740000,
|
||||||
received_at_ms: 1522540740000,
|
received_at_ms: 1522540740000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -196,6 +204,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1519912800000,
|
received_at: 1519912800000,
|
||||||
received_at_ms: 1519912800000,
|
received_at_ms: 1519912800000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -219,6 +228,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1298937540000,
|
received_at: 1298937540000,
|
||||||
received_at_ms: 1298937540000,
|
received_at_ms: 1298937540000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
@ -235,6 +245,7 @@ describe('groupMediaItemsByDate', () => {
|
||||||
received_at: 1296554400000,
|
received_at: 1296554400000,
|
||||||
received_at_ms: 1296554400000,
|
received_at_ms: 1296554400000,
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
sent_at: Date.now(),
|
||||||
},
|
},
|
||||||
attachment: {
|
attachment: {
|
||||||
fileName: 'fileName',
|
fileName: 'fileName',
|
||||||
|
|
|
@ -12,6 +12,8 @@ export type MessageAttributesType = {
|
||||||
received_at: number;
|
received_at: number;
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
received_at_ms: number;
|
received_at_ms: number;
|
||||||
|
// eslint-disable-next-line camelcase
|
||||||
|
sent_at: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MediaItemType = {
|
export type MediaItemType = {
|
||||||
|
|
|
@ -26,7 +26,10 @@ import {
|
||||||
MessageAttributesType,
|
MessageAttributesType,
|
||||||
} from '../model-types.d';
|
} from '../model-types.d';
|
||||||
import { LinkPreviewType } from '../types/message/LinkPreviews';
|
import { LinkPreviewType } from '../types/message/LinkPreviews';
|
||||||
import { MediaItemType } from '../types/MediaItem';
|
import {
|
||||||
|
MediaItemType,
|
||||||
|
MessageAttributesType as MediaItemMessageType,
|
||||||
|
} from '../types/MediaItem';
|
||||||
import { MessageModel } from '../models/messages';
|
import { MessageModel } from '../models/messages';
|
||||||
import { assert } from '../util/assert';
|
import { assert } from '../util/assert';
|
||||||
import { maybeParseUrl } from '../util/url';
|
import { maybeParseUrl } from '../util/url';
|
||||||
|
@ -2614,6 +2617,7 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
id: message.id,
|
id: message.id,
|
||||||
received_at: message.received_at,
|
received_at: message.received_at,
|
||||||
received_at_ms: Number(message.received_at_ms),
|
received_at_ms: Number(message.received_at_ms),
|
||||||
|
sent_at: message.sent_at,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -2958,6 +2962,7 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
conversationId: message.get('conversationId'),
|
conversationId: message.get('conversationId'),
|
||||||
received_at: message.get('received_at'),
|
received_at: message.get('received_at'),
|
||||||
received_at_ms: message.get('received_at_ms'),
|
received_at_ms: message.get('received_at_ms'),
|
||||||
|
sent_at: message.get('sent_at'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -3058,13 +3063,21 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
selectedMediaItem: MediaItemType,
|
selectedMediaItem: MediaItemType,
|
||||||
media: Array<MediaItemType> = []
|
media: Array<MediaItemType> = []
|
||||||
) {
|
) {
|
||||||
const onSave = async (options: WhatIsThis = {}) => {
|
const onSave = async ({
|
||||||
|
attachment,
|
||||||
|
message,
|
||||||
|
index,
|
||||||
|
}: {
|
||||||
|
attachment: AttachmentType;
|
||||||
|
message: MediaItemMessageType;
|
||||||
|
index: number;
|
||||||
|
}) => {
|
||||||
const fullPath = await window.Signal.Types.Attachment.save({
|
const fullPath = await window.Signal.Types.Attachment.save({
|
||||||
attachment: options.attachment,
|
attachment,
|
||||||
index: options.index + 1,
|
index: index + 1,
|
||||||
readAttachmentData,
|
readAttachmentData,
|
||||||
saveAttachmentToDisk,
|
saveAttachmentToDisk,
|
||||||
timestamp: options.message.get('sent_at'),
|
timestamp: message.sent_at,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (fullPath) {
|
if (fullPath) {
|
||||||
|
@ -3146,6 +3159,7 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
)?.id || message.get('conversationId'),
|
)?.id || message.get('conversationId'),
|
||||||
received_at: message.get('received_at'),
|
received_at: message.get('received_at'),
|
||||||
received_at_ms: message.get('received_at_ms'),
|
received_at_ms: message.get('received_at_ms'),
|
||||||
|
sent_at: message.get('sent_at'),
|
||||||
},
|
},
|
||||||
attachment: item,
|
attachment: item,
|
||||||
thumbnailObjectUrl:
|
thumbnailObjectUrl:
|
||||||
|
@ -3590,6 +3604,7 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
id: message.id,
|
id: message.id,
|
||||||
received_at: message.received_at,
|
received_at: message.received_at,
|
||||||
received_at_ms: Number(message.received_at_ms),
|
received_at_ms: Number(message.received_at_ms),
|
||||||
|
sent_at: message.sent_at,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue