From ae33a8a61b5649abb65eed47613653f92520f568 Mon Sep 17 00:00:00 2001 From: olcxja Date: Thu, 18 Jun 2026 07:28:27 +0200 Subject: [PATCH] Fix "messages.loading.older" message & fix app crash on unsupported blahs --- android/app/src/main/assets/public/main.js | 9 +++++++-- webroot/main.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/assets/public/main.js b/android/app/src/main/assets/public/main.js index 19223816..5af85a61 100644 --- a/android/app/src/main/assets/public/main.js +++ b/android/app/src/main/assets/public/main.js @@ -834,10 +834,12 @@ async function initBlahs() { try { //try user lang first res = await fetchAsync(`${path}blah/${lang}.json`); + blah = JSON.parse(res); } catch (e) { //fallback to en-us res = await fetchAsync(`${path}blah/en-us.json`); + blah = JSON.parse(res); } - blah = JSON.parse(res); + let blahTags = document.getElementsByTagName("blah"); for (let i = 0; i < blahTags.length; i++) { @@ -2403,6 +2405,7 @@ function handleMessageContextMenu(e, msgId) { async function deleteMessage(msgId) { if (fixedContextMenu) fixedContextMenu.classList.remove("show"); + if (typeof clearContextMenuStyles === "function") clearContextMenuStyles(); showAction("action.message.deleting", "msgdel"); try { let msgPayload = { @@ -2439,7 +2442,7 @@ async function scrollToMessage(msgId) { }, 1500); } else { if (oldestLoadedMsgId !== null && parseInt(msgId) < oldestLoadedMsgId) { - showAction("info.sending.message", "msgscroll"); + showAction("info.messages.loading.older", "msgscroll"); let tries = 0; while (!document.getElementById(`msg-${msgId}`) && oldestLoadedMsgId > 0 && tries < 15) { await loadDmMessages(currentDmId, (oldestLoadedMsgId - 1).toString(), true); @@ -2464,6 +2467,7 @@ async function scrollToMessage(msgId) { async function replyMessage(msgId) { if (fixedContextMenu) fixedContextMenu.classList.remove("show"); + if (typeof clearContextMenuStyles === "function") clearContextMenuStyles(); let msg = loadedMessages[msgId]; if (msg && msg.author) { @@ -2501,6 +2505,7 @@ async function replyMessage(msgId) { async function reactMessagePrompt(msgId, quickReaction = null) { if (fixedContextMenu) fixedContextMenu.classList.remove("show"); + if (typeof clearContextMenuStyles === "function") clearContextMenuStyles(); let reaction = quickReaction; if (!reaction) { reaction = prompt("Enter reaction (emoji or text):"); diff --git a/webroot/main.js b/webroot/main.js index 19223816..5af85a61 100644 --- a/webroot/main.js +++ b/webroot/main.js @@ -834,10 +834,12 @@ async function initBlahs() { try { //try user lang first res = await fetchAsync(`${path}blah/${lang}.json`); + blah = JSON.parse(res); } catch (e) { //fallback to en-us res = await fetchAsync(`${path}blah/en-us.json`); + blah = JSON.parse(res); } - blah = JSON.parse(res); + let blahTags = document.getElementsByTagName("blah"); for (let i = 0; i < blahTags.length; i++) { @@ -2403,6 +2405,7 @@ function handleMessageContextMenu(e, msgId) { async function deleteMessage(msgId) { if (fixedContextMenu) fixedContextMenu.classList.remove("show"); + if (typeof clearContextMenuStyles === "function") clearContextMenuStyles(); showAction("action.message.deleting", "msgdel"); try { let msgPayload = { @@ -2439,7 +2442,7 @@ async function scrollToMessage(msgId) { }, 1500); } else { if (oldestLoadedMsgId !== null && parseInt(msgId) < oldestLoadedMsgId) { - showAction("info.sending.message", "msgscroll"); + showAction("info.messages.loading.older", "msgscroll"); let tries = 0; while (!document.getElementById(`msg-${msgId}`) && oldestLoadedMsgId > 0 && tries < 15) { await loadDmMessages(currentDmId, (oldestLoadedMsgId - 1).toString(), true); @@ -2464,6 +2467,7 @@ async function scrollToMessage(msgId) { async function replyMessage(msgId) { if (fixedContextMenu) fixedContextMenu.classList.remove("show"); + if (typeof clearContextMenuStyles === "function") clearContextMenuStyles(); let msg = loadedMessages[msgId]; if (msg && msg.author) { @@ -2501,6 +2505,7 @@ async function replyMessage(msgId) { async function reactMessagePrompt(msgId, quickReaction = null) { if (fixedContextMenu) fixedContextMenu.classList.remove("show"); + if (typeof clearContextMenuStyles === "function") clearContextMenuStyles(); let reaction = quickReaction; if (!reaction) { reaction = prompt("Enter reaction (emoji or text):");