Merge branch 'master' of github.com:the-djmaze/snappymail

This commit is contained in:
the-djmaze 2023-11-17 00:09:00 +01:00
commit 36c8b97cb1
2 changed files with 24 additions and 12 deletions

View file

@ -301,9 +301,13 @@ populateMessageBody = (oMessage, popup) => {
} else { } else {
let json = oData?.Result; let json = oData?.Result;
if (json if (json
&& oMessage.hash === json.hash && ((
// && oMessage.folder === json.folder oMessage.hash && oMessage.hash === json.hash
// && oMessage.uid == json.uid ) || (
!oMessage.hash
&& oMessage.folder === json.folder
&& oMessage.uid == json.uid)
)
&& oMessage.revivePropertiesFromJson(json) && oMessage.revivePropertiesFromJson(json)
) { ) {
/* /*

View file

@ -13,6 +13,7 @@ document.onreadystatechange = () => {
passThemesToIFrame(); passThemesToIFrame();
let form = document.querySelector('form.snappymail'); let form = document.querySelector('form.snappymail');
form && SnappyMailFormHelper(form); form && SnappyMailFormHelper(form);
setupUnifiedSearchListener()
} }
}; };
@ -136,15 +137,22 @@ function SnappyMailFormHelper(oForm)
return false; return false;
}); });
} } catch (e) {
catch(e) {
console.error(e); console.error(e);
} }
} }
function setupUnifiedSearchListener() {
const iframe = document.getElementById('rliframe');
if (!iframe || !iframe.contentWindow) return;
addEventListener('hashchange', (event) => { addEventListener('hashchange', (event) => {
const search = event.newURL.substring(event.newURL.lastIndexOf('/') + 1); const hashIndex = event.newURL.indexOf('#/mailbox/');
if (search && search.length < 25) { if (hashIndex !== -1) {
document.getElementById('rliframe').contentWindow.rl.app.messageList.mainSearch(search); const hash = event.newURL.substring(hashIndex + 1);
if (/\/[\w-]+\/[\w-]+\/\w\d+\/.{0,24}/.test(hash)) {
iframe.contentWindow.location.hash = hash;
}
} }
}); });
}