Skip to content

Commit d49200c

Browse files
authored
Merge pull request #345 from GetStream/fix-edit-message-with-video-attachments
fix: Video attachments disappear during message edit #323
2 parents 32a7570 + 764306c commit d49200c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

projects/stream-chat-angular/src/lib/attachment.service.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ describe('AttachmentService', () => {
297297
it('should create attachmentUploads from attachments', () => {
298298
const imageFile = { name: 'flower.png' };
299299
const dataFile = { name: 'note.txt', size: 3272969 };
300+
const videoFile = { name: 'cute.mov', size: 45367543 };
300301
const result = [
301302
{
302303
file: imageFile,
@@ -310,6 +311,12 @@ describe('AttachmentService', () => {
310311
url: 'url/to/data',
311312
type: 'file',
312313
},
314+
{
315+
file: videoFile,
316+
state: 'success',
317+
url: 'url/to/video',
318+
type: 'video',
319+
},
313320
];
314321
const attachments = [
315322
{ fallback: 'flower.png', image_url: 'url/to/img', type: 'image' },
@@ -319,6 +326,12 @@ describe('AttachmentService', () => {
319326
asset_url: 'url/to/data',
320327
type: 'file',
321328
},
329+
{
330+
title: 'cute.mov',
331+
file_size: 45367543,
332+
asset_url: 'url/to/video',
333+
type: 'video',
334+
},
322335
];
323336
const spy = jasmine.createSpy();
324337
service.attachmentUploads$.subscribe(spy);

projects/stream-chat-angular/src/lib/attachment.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ export class AttachmentService {
177177
name: attachment.fallback,
178178
} as File,
179179
});
180-
} else if (attachment.type === 'file') {
180+
} else if (attachment.type === 'file' || attachment.type === 'video') {
181181
attachmentUploads.push({
182182
url: attachment.asset_url,
183183
state: 'success',
184184
file: {
185185
name: attachment.title,
186186
size: attachment.file_size,
187187
} as File,
188-
type: 'file',
188+
type: attachment.type,
189189
});
190190
}
191191
});

0 commit comments

Comments
 (0)