Fix "messages.loading.older" message & fix app crash on unsupported blahs
This commit is contained in:
parent
3f0f628569
commit
ae33a8a61b
2 changed files with 14 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
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):");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
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):");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue