fix: Bug - Video attachment on android gets sent in the message bubble above with no preview image

This commit is contained in:
2026-06-11 02:44:22 +02:00
parent b1b3d93851
commit d72a027c9a
10 changed files with 315 additions and 25 deletions
@@ -11,6 +11,7 @@ import {
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
import { switchMap } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { v4 as uuidv4 } from 'uuid';
import { ElectronBridgeService } from '../../../../core/platform/electron/electron-bridge.service';
import { ViewportService } from '../../../../core/platform';
import { BottomSheetComponent } from '../../../../shared';
@@ -36,6 +37,7 @@ import { KlipyGifPickerComponent } from '../klipy-gif-picker/klipy-gif-picker.co
import { ChatMessageListComponent } from './components/message-list/chat-message-list.component';
import { ChatMessageOverlaysComponent } from './components/message-overlays/chat-message-overlays.component';
import { stepLightboxIndex } from '../../domain/rules/chat-message-lightbox.rules';
import { planChatMessageSend } from '../../domain/rules/chat-message-send.rules';
import {
ChatLightboxState,
ChatMessageComposerSubmitEvent,
@@ -117,18 +119,20 @@ export class ChatMessagesComponent {
handleMessageSubmitted(event: ChatMessageComposerSubmitEvent): void {
this.messageList?.scrollToBottomAfterLocalSend();
this.store.dispatch(
MessagesActions.sendMessage({
content: event.content,
replyToId: this.replyTo()?.id,
channelId: this.activeChannelId()
})
);
const plan = planChatMessageSend({
generateId: uuidv4,
content: event.content,
pendingFiles: event.pendingFiles,
replyToId: this.replyTo()?.id,
channelId: this.activeChannelId()
});
this.store.dispatch(MessagesActions.sendMessage(plan.action));
this.clearReply();
if (event.pendingFiles.length > 0) {
setTimeout(() => this.attachFilesToLastOwnMessage(event.content, event.pendingFiles), 100);
if (plan.attachmentBinding) {
this.attachFilesToMessage(plan.attachmentBinding.messageId, plan.attachmentBinding.files);
}
}
@@ -493,21 +497,14 @@ export class ChatMessagesComponent {
});
}
private attachFilesToLastOwnMessage(content: string, pendingFiles: File[]): void {
private attachFilesToMessage(messageId: string, pendingFiles: File[]): void {
const currentUserId = this.currentUser()?.id;
const roomId = this.currentRoom()?.id;
if (!currentUserId)
return;
const message = [...this.channelMessages()]
.reverse()
.find((entry) => entry.senderId === currentUserId && entry.content === content && !entry.isDeleted);
if (!message) {
setTimeout(() => this.attachFilesToLastOwnMessage(content, pendingFiles), 150);
return;
if (roomId) {
this.attachmentsSvc.rememberMessageRoom(messageId, roomId);
}
this.attachmentsSvc.publishAttachments(message.id, pendingFiles, currentUserId || undefined);
this.attachmentsSvc.publishAttachments(messageId, pendingFiles, currentUserId || undefined);
}
}