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
|
try { //try user lang first
|
||||||
res = await fetchAsync(`${path}blah/${lang}.json`);
|
res = await fetchAsync(`${path}blah/${lang}.json`);
|
||||||
|
blah = JSON.parse(res);
|
||||||
} catch (e) { //fallback to en-us
|
} catch (e) { //fallback to en-us
|
||||||
res = await fetchAsync(`${path}blah/en-us.json`);
|
res = await fetchAsync(`${path}blah/en-us.json`);
|
||||||
|
blah = JSON.parse(res);
|
||||||
}
|
}
|
||||||
blah = JSON.parse(res);
|
|
||||||
|
|
||||||
let blahTags = document.getElementsByTagName("blah");
|
let blahTags = document.getElementsByTagName("blah");
|
||||||
for (let i = 0; i < blahTags.length; i++) {
|
for (let i = 0; i < blahTags.length; i++) {
|
||||||
|
|
@ -2403,6 +2405,7 @@ function handleMessageContextMenu(e, msgId) {
|
||||||
|
|
||||||
async function deleteMessage(msgId) {
|
async function deleteMessage(msgId) {
|
||||||
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
||||||
|
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
|
||||||
showAction("action.message.deleting", "msgdel");
|
showAction("action.message.deleting", "msgdel");
|
||||||
try {
|
try {
|
||||||
let msgPayload = {
|
let msgPayload = {
|
||||||
|
|
@ -2439,7 +2442,7 @@ async function scrollToMessage(msgId) {
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
if (oldestLoadedMsgId !== null && parseInt(msgId) < oldestLoadedMsgId) {
|
if (oldestLoadedMsgId !== null && parseInt(msgId) < oldestLoadedMsgId) {
|
||||||
showAction("info.sending.message", "msgscroll");
|
showAction("info.messages.loading.older", "msgscroll");
|
||||||
let tries = 0;
|
let tries = 0;
|
||||||
while (!document.getElementById(`msg-${msgId}`) && oldestLoadedMsgId > 0 && tries < 15) {
|
while (!document.getElementById(`msg-${msgId}`) && oldestLoadedMsgId > 0 && tries < 15) {
|
||||||
await loadDmMessages(currentDmId, (oldestLoadedMsgId - 1).toString(), true);
|
await loadDmMessages(currentDmId, (oldestLoadedMsgId - 1).toString(), true);
|
||||||
|
|
@ -2464,6 +2467,7 @@ async function scrollToMessage(msgId) {
|
||||||
|
|
||||||
async function replyMessage(msgId) {
|
async function replyMessage(msgId) {
|
||||||
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
||||||
|
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
|
||||||
|
|
||||||
let msg = loadedMessages[msgId];
|
let msg = loadedMessages[msgId];
|
||||||
if (msg && msg.author) {
|
if (msg && msg.author) {
|
||||||
|
|
@ -2501,6 +2505,7 @@ async function replyMessage(msgId) {
|
||||||
|
|
||||||
async function reactMessagePrompt(msgId, quickReaction = null) {
|
async function reactMessagePrompt(msgId, quickReaction = null) {
|
||||||
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
||||||
|
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
|
||||||
let reaction = quickReaction;
|
let reaction = quickReaction;
|
||||||
if (!reaction) {
|
if (!reaction) {
|
||||||
reaction = prompt("Enter reaction (emoji or text):");
|
reaction = prompt("Enter reaction (emoji or text):");
|
||||||
|
|
|
||||||
|
|
@ -834,10 +834,12 @@ async function initBlahs() {
|
||||||
|
|
||||||
try { //try user lang first
|
try { //try user lang first
|
||||||
res = await fetchAsync(`${path}blah/${lang}.json`);
|
res = await fetchAsync(`${path}blah/${lang}.json`);
|
||||||
|
blah = JSON.parse(res);
|
||||||
} catch (e) { //fallback to en-us
|
} catch (e) { //fallback to en-us
|
||||||
res = await fetchAsync(`${path}blah/en-us.json`);
|
res = await fetchAsync(`${path}blah/en-us.json`);
|
||||||
|
blah = JSON.parse(res);
|
||||||
}
|
}
|
||||||
blah = JSON.parse(res);
|
|
||||||
|
|
||||||
let blahTags = document.getElementsByTagName("blah");
|
let blahTags = document.getElementsByTagName("blah");
|
||||||
for (let i = 0; i < blahTags.length; i++) {
|
for (let i = 0; i < blahTags.length; i++) {
|
||||||
|
|
@ -2403,6 +2405,7 @@ function handleMessageContextMenu(e, msgId) {
|
||||||
|
|
||||||
async function deleteMessage(msgId) {
|
async function deleteMessage(msgId) {
|
||||||
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
||||||
|
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
|
||||||
showAction("action.message.deleting", "msgdel");
|
showAction("action.message.deleting", "msgdel");
|
||||||
try {
|
try {
|
||||||
let msgPayload = {
|
let msgPayload = {
|
||||||
|
|
@ -2439,7 +2442,7 @@ async function scrollToMessage(msgId) {
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
if (oldestLoadedMsgId !== null && parseInt(msgId) < oldestLoadedMsgId) {
|
if (oldestLoadedMsgId !== null && parseInt(msgId) < oldestLoadedMsgId) {
|
||||||
showAction("info.sending.message", "msgscroll");
|
showAction("info.messages.loading.older", "msgscroll");
|
||||||
let tries = 0;
|
let tries = 0;
|
||||||
while (!document.getElementById(`msg-${msgId}`) && oldestLoadedMsgId > 0 && tries < 15) {
|
while (!document.getElementById(`msg-${msgId}`) && oldestLoadedMsgId > 0 && tries < 15) {
|
||||||
await loadDmMessages(currentDmId, (oldestLoadedMsgId - 1).toString(), true);
|
await loadDmMessages(currentDmId, (oldestLoadedMsgId - 1).toString(), true);
|
||||||
|
|
@ -2464,6 +2467,7 @@ async function scrollToMessage(msgId) {
|
||||||
|
|
||||||
async function replyMessage(msgId) {
|
async function replyMessage(msgId) {
|
||||||
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
||||||
|
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
|
||||||
|
|
||||||
let msg = loadedMessages[msgId];
|
let msg = loadedMessages[msgId];
|
||||||
if (msg && msg.author) {
|
if (msg && msg.author) {
|
||||||
|
|
@ -2501,6 +2505,7 @@ async function replyMessage(msgId) {
|
||||||
|
|
||||||
async function reactMessagePrompt(msgId, quickReaction = null) {
|
async function reactMessagePrompt(msgId, quickReaction = null) {
|
||||||
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
if (fixedContextMenu) fixedContextMenu.classList.remove("show");
|
||||||
|
if (typeof clearContextMenuStyles === "function") clearContextMenuStyles();
|
||||||
let reaction = quickReaction;
|
let reaction = quickReaction;
|
||||||
if (!reaction) {
|
if (!reaction) {
|
||||||
reaction = prompt("Enter reaction (emoji or text):");
|
reaction = prompt("Enter reaction (emoji or text):");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue