Skip to content

Commit 58664aa

Browse files
committed
fix(frontend): avoid unintentional request of the message mailbox when opening a message from the combined view
1 parent b8d8e7c commit 58664aa

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/imap/js_modules/route_handlers.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,22 @@ function applyImapMessageContentPageHandlers(routeParams) {
2323
window.dispatchEvent(new CustomEvent('message-loaded'));
2424
});
2525

26-
const messages = new Hm_MessagesStore(routeParams.list_path, routeParams.list_page, `${routeParams.keyword}_${routeParams.filter}`, getParam('sort'));
26+
const listPath = routeParams.list_parent || routeParams.list_path;
27+
const messages = new Hm_MessagesStore(listPath, routeParams.list_page, `${routeParams.keyword}_${routeParams.filter}`, getParam('sort'));
2728
messages.load(false);
2829
const next = messages.getNextRowForMessage(routeParams.uid);
2930
const prev = messages.getPreviousRowForMessage(routeParams.uid);
3031
if (next) {
32+
const nextHref = $(next['0']).find(".subject a").prop('href');
33+
const nextListPath = new URLSearchParams(nextHref.split('?')[1]).get('list_path');
3134
const nextMessageUid = $(next['0']).data('uid');
32-
preFetchMessageContent(false, nextMessageUid, routeParams.list_path);
35+
preFetchMessageContent(false, nextMessageUid, nextListPath);
3336
}
3437
if (prev) {
38+
const prevHref = $(prev['0']).find(".subject a").prop('href');
39+
const prevListPath = new URLSearchParams(prevHref.split('?')[1]).get('list_path');
3540
const prevMessageUid = $(prev['0']).data('uid');
36-
preFetchMessageContent(false, prevMessageUid, routeParams.list_path);
41+
preFetchMessageContent(false, prevMessageUid, prevListPath);
3742
}
3843

3944
if (window.pgpMessageContentPageHandler) pgpMessageContentPageHandler();

0 commit comments

Comments
 (0)