Skip to content

Commit 4d09992

Browse files
committed
fix: Custom attachment list ignored inside quoted message
1 parent b859c6f commit 4d09992

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

projects/stream-chat-angular/src/lib/message/message.component.html

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,31 @@
384384
[user]="message?.quoted_message?.user || undefined"
385385
></stream-avatar-placeholder>
386386
<div class="quoted-message-inner">
387-
<stream-attachment-list
387+
<ng-container
388388
*ngIf="
389389
message?.quoted_message?.attachments &&
390390
message?.quoted_message?.attachments?.length
391391
"
392-
[attachments]="quotedMessageAttachments"
393-
[messageId]="message?.quoted_message?.id"
394-
[parentMessageId]="message?.quoted_message?.parent_id"
395-
></stream-attachment-list>
392+
>
393+
<ng-template
394+
#defaultAttachments
395+
let-messageId="messageId"
396+
let-attachments="attachments"
397+
let-parentMessageId="parentMessageId"
398+
>
399+
<stream-attachment-list
400+
[messageId]="messageId"
401+
[attachments]="attachments"
402+
[parentMessageId]="parentMessageId"
403+
></stream-attachment-list>
404+
</ng-template>
405+
<ng-container
406+
*ngTemplateOutlet="
407+
attachmentListTemplate || defaultAttachments;
408+
context: getQuotedMessageAttachmentListContext()
409+
"
410+
></ng-container>
411+
</ng-container>
396412
<div
397413
data-testid="quoted-message-text"
398414
[innerHTML]="

projects/stream-chat-angular/src/lib/message/message.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ describe('MessageComponent', () => {
563563
...message,
564564
...{ attachments },
565565
};
566-
component.message!.parent_id = 'parent-id';
566+
component.message.parent_id = 'parent-id';
567567
fixture.detectChanges();
568568
const attachmentComponent = queryAttachmentComponent();
569569

projects/stream-chat-angular/src/lib/message/message.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ export class MessageComponent implements OnInit, OnChanges, OnDestroy {
213213
};
214214
}
215215

216+
getQuotedMessageAttachmentListContext(): AttachmentListContext {
217+
return {
218+
messageId: this.message?.quoted_message?.id || '',
219+
attachments: this.quotedMessageAttachments,
220+
parentMessageId: this?.message?.quoted_message?.parent_id,
221+
};
222+
}
223+
216224
getMessageReactionsContext(): MessageReactionsContext {
217225
return {
218226
messageReactionCounts: this.message?.reaction_counts || {},

0 commit comments

Comments
 (0)