Skip to content

Commit 0c1633b

Browse files
committed
pr reviews: correctly set references header
1 parent e59f3b8 commit 0c1633b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

extension/chrome/elements/compose-modules/compose-render-module.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ export class ComposeRenderModule extends ViewModule<ComposeView> {
101101
const msgId = inReplyToMessage.payload?.headers?.find(header => header.name === 'Message-Id' || header.name === 'Message-ID')?.value;
102102
const references = inReplyToMessage.payload?.headers?.find(header => header.name === 'References')?.value;
103103
if (msgId && references) {
104-
this.view.sendBtnModule.additionalMsgHeaders['In-Reply-To'] = msgId;
105-
this.view.sendBtnModule.additionalMsgHeaders.References = references + ' ' + msgId;
104+
this.setReplyHeaders(msgId, references);
106105
}
107106
}
108107
this.view.replyParams.subject = `${this.responseMethod === 'reply' ? 'Re' : 'Fwd'}: ${this.view.replyParams.subject}`;
@@ -120,8 +119,7 @@ export class ComposeRenderModule extends ViewModule<ComposeView> {
120119
);
121120
if (this.view.quoteModule.messageToReplyOrForward) {
122121
const msgId = this.view.quoteModule.messageToReplyOrForward.headers['message-id'];
123-
this.view.sendBtnModule.additionalMsgHeaders['In-Reply-To'] = msgId;
124-
this.view.sendBtnModule.additionalMsgHeaders.References = this.view.quoteModule.messageToReplyOrForward.headers.references + ' ' + msgId;
122+
this.setReplyHeaders(msgId, this.view.quoteModule.messageToReplyOrForward.headers.references);
125123
if (this.view.replyPubkeyMismatch) {
126124
await this.renderReplyMsgAsReplyPubkeyMismatch();
127125
} else if (this.view.quoteModule.messageToReplyOrForward.isOnlySigned) {
@@ -276,6 +274,13 @@ export class ComposeRenderModule extends ViewModule<ComposeView> {
276274
}
277275
};
278276

277+
private setReplyHeaders = (msgId?: string, references?: string) => {
278+
if (msgId) {
279+
this.view.sendBtnModule.additionalMsgHeaders['In-Reply-To'] = msgId;
280+
this.view.sendBtnModule.additionalMsgHeaders.References = [references, msgId].filter(Boolean).join(' ');
281+
}
282+
};
283+
279284
private initComposeBoxStyles = () => {
280285
if (this.view.isReplyBox) {
281286
this.view.S.cached('body').addClass('reply_box');

0 commit comments

Comments
 (0)