From: Dessalines Date: Fri, 21 Oct 2022 18:14:28 +0000 (-0400) Subject: Fixing up popup code. X-Git-Url: http://these/git/%7BimageSrc%7D?a=commitdiff_plain;h=6bd795c89b28ed81e23bf04f3b8c0b839b2318b0;p=lemmy-ui.git Fixing up popup code. --- diff --git a/lemmy-translations b/lemmy-translations index ae3132f..94b9b5d 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit ae3132fef13542ab7fc337361bf484183d12d786 +Subproject commit 94b9b5debdaa40facf13a852cb096ef0cbd34ad7 diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 33447eb..8cdfaad 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -386,9 +386,9 @@ export class MarkdownTextArea extends Component< let textarea: any = document.getElementById(i.id); autosize.update(textarea); pictrsDeleteToast( - i18n.t("click_to_delete_picture").concat(' (', file.name,')'), - i18n.t("picture_deleted").concat(' (', file.name,')'), - i18n.t("fail_picture_deleted").concat(' (', file.name,')'), + `${i18n.t("click_to_delete_picture")}: ${file.name}`, + `${i18n.t("picture_deleted")}: ${file.name}`, + `${i18n.t("failed_to_delete_picture")}: ${file.name}`, deleteUrl ); } else { diff --git a/src/shared/components/post/post-form.tsx b/src/shared/components/post/post-form.tsx index 8addc85..0f8ea0b 100644 --- a/src/shared/components/post/post-form.tsx +++ b/src/shared/components/post/post-form.tsx @@ -641,8 +641,9 @@ export class PostForm extends Component { i.state.postForm.url = Some(url); i.setState({ imageLoading: false }); pictrsDeleteToast( - i18n.t("click_to_delete_picture"), - i18n.t("picture_deleted"), + `${i18n.t("click_to_delete_picture")}: ${file.name}`, + `${i18n.t("picture_deleted")}: ${file.name}`, + `${i18n.t("failed_to_delete_picture")}: ${file.name}`, deleteUrl ); } else { diff --git a/src/shared/utils.ts b/src/shared/utils.ts index d0b9b4b..b65c425 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -553,16 +553,14 @@ export function pictrsDeleteToast( duration: 10000, onClick: () => { if (toast) { - fetch(deleteUrl, {}) - .then( res => { - console.log(res) + fetch(deleteUrl).then(res => { toast.hideToast(); - if (res.ok === true){ + if (res.ok === true) { alert(deletePictureText); - } else{ + } else { alert(failedDeletePictureText); } - }) + }); } }, close: true,