Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ export class ComposeRenderModule extends ViewModule<ComposeView> {
const thread = await this.view.emailProvider.threadGet(this.view.threadId, 'metadata');
const inReplyToMessage = thread.messages?.find(message => message.id === this.view.replyMsgId);
if (inReplyToMessage) {
this.view.replyParams.inReplyTo = inReplyToMessage.payload?.headers?.find(
header => header.name === 'Message-Id' || header.name === 'Message-ID'
)?.value;
const msgId = inReplyToMessage.payload?.headers?.find(header => header.name === 'Message-Id' || header.name === 'Message-ID')?.value;
if (msgId) {
this.view.sendBtnModule.additionalMsgHeaders['In-Reply-To'] = msgId;
this.view.sendBtnModule.additionalMsgHeaders.References = msgId;
}
}
this.view.replyParams.subject = `${this.responseMethod === 'reply' ? 'Re' : 'Fwd'}: ${this.view.replyParams.subject}`;
if (this.view.useFullScreenSecureCompose) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export abstract class WebmailElementReplacer {
private replacePgpElsInterval: number;

public abstract getIntervalFunctions: () => IntervalFunction[];
public abstract setReplyBoxEditable: () => Promise<void>;
public abstract setReplyBoxEditable: (messageContainer?: JQuery<Element>) => Promise<void>;
public abstract reinsertReplyBox: (replyMsgId: string) => void;
public abstract scrollToReplyBox: (replyMsgId: string) => void;
public abstract scrollToCursorInReplyBox: (replyMsgId: string, cursorOffsetTop: number) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export class GmailElementReplacer extends WebmailElementReplacer {
];
};

public setReplyBoxEditable = async () => {
public setReplyBoxEditable = async (messageContainer?: JQuery<Element>) => {
const replyContainerIframe = $('.reply_message_iframe_container > iframe').last();
if (replyContainerIframe.length) {
$(replyContainerIframe).replaceWith(this.factory.embeddedReply(this.getLastMsgReplyParams(this.getConvoRootEl(replyContainerIframe[0])), true)); // xss-safe-value
if (replyContainerIframe.length && messageContainer) {
$(replyContainerIframe).replaceWith(this.factory.embeddedReply(this.getLastMsgReplyParams(messageContainer), true)); // xss-safe-value
} else {
await this.replaceStandardReplyBox(undefined, true);
}
Expand Down Expand Up @@ -351,10 +351,10 @@ export class GmailElementReplacer extends WebmailElementReplacer {
return;
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const messageContainer = $(btn.closest('.h7')!);
const messageContainer: JQuery<Element> = $(btn.closest('.h7')!);
if (messageContainer.is(':last-child')) {
if (this.isEncrypted()) {
await this.setReplyBoxEditable();
await this.setReplyBoxEditable(messageContainer);
} else {
await this.replaceStandardReplyBox(undefined, true);
}
Expand Down Expand Up @@ -589,8 +589,10 @@ export class GmailElementReplacer extends WebmailElementReplacer {
return from ? Str.parseEmail(from) : undefined;
};

private getLastMsgReplyParams = (convoRootEl: JQuery): FactoryReplyParams => {
return { replyMsgId: this.determineMsgId($(convoRootEl).find(this.sel.msgInner).last()) };
private getLastMsgReplyParams = (convoRootEl: JQuery<Element>): FactoryReplyParams => {
const msgIdElement = $(convoRootEl).find('[data-legacy-message-id], [data-message-id]');
const msgId = msgIdElement.attr('data-legacy-message-id') || msgIdElement.attr('data-message-id');
return { replyMsgId: msgId };
};

private getConvoRootEl = (anyInnerElement: HTMLElement) => {
Expand Down