add try catch for invalid replies
This commit is contained in:
parent
59f40b2983
commit
7c9499ae31
@ -115,6 +115,7 @@ async function createPost(username,text,time,specialtext,postid,isbot,reply_id)
|
|||||||
newP.innerHTML += `<button onclick="reply('${username}',${postid},\`${htmlesc(htmlesc(text))}\`)">Reply to this Post</button>`
|
newP.innerHTML += `<button onclick="reply('${username}',${postid},\`${htmlesc(htmlesc(text))}\`)">Reply to this Post</button>`
|
||||||
|
|
||||||
if(reply_id != 0) {
|
if(reply_id != 0) {
|
||||||
|
try {
|
||||||
const reply_obj = await fetch(`/api/getPost?id=${reply_id}`)
|
const reply_obj = await fetch(`/api/getPost?id=${reply_id}`)
|
||||||
const reply_username = decodeURIComponent(reply_obj.post_user_name)
|
const reply_username = decodeURIComponent(reply_obj.post_user_name)
|
||||||
const reply_username_text = document.createTextNode(reply_username)
|
const reply_username_text = document.createTextNode(reply_username)
|
||||||
@ -127,9 +128,10 @@ async function createPost(username,text,time,specialtext,postid,isbot,reply_id)
|
|||||||
replyDiv.appendChild(replyAvatar)
|
replyDiv.appendChild(replyAvatar)
|
||||||
replyDiv.appendChild(reply_username_text)
|
replyDiv.appendChild(reply_username_text)
|
||||||
replyDiv.appendChild(spacerTextNode())
|
replyDiv.appendChild(spacerTextNode())
|
||||||
replyDiv.appendChild(filterPost(reply_text))
|
replyDiv.innerHTML += filterPost(reply_text)
|
||||||
replyDiv.appendChild(replyBr)
|
replyDiv.appendChild(replyBr)
|
||||||
newDiv.appendChild(replyDiv)
|
newDiv.appendChild(replyDiv)
|
||||||
|
} catch (ignored) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
newDiv.appendChild(newP)
|
newDiv.appendChild(newP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user