summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post-form.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-06-10 22:47:06 -0400
committerDessalines <tyhou13@gmx.com>2020-06-10 22:47:06 -0400
commit4cf1f080bf113d6e30383eb1fddd37ce16025558 (patch)
tree13f6c91876336a8869a77e2ebb55242a7b08807a /ui/src/components/post-form.tsx
parent2fbd44c59db9c94f7cd2055550066f429a19154b (diff)
Adding delete picture via pict-rs delete tokens. Fixes #505
Diffstat (limited to 'ui/src/components/post-form.tsx')
-rw-r--r--ui/src/components/post-form.tsx8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx
index 7811f918..d424538b 100644
--- a/ui/src/components/post-form.tsx
+++ b/ui/src/components/post-form.tsx
@@ -35,6 +35,7 @@ import {
setupTribute,
setupTippy,
emojiPicker,
+ pictrsDeleteToast,
} from '../utils';
import autosize from 'autosize';
import Tribute from 'tributejs/src/Tribute.js';
@@ -536,9 +537,16 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
if (res.msg == 'ok') {
let hash = res.files[0].file;
let url = `${window.location.origin}/pictrs/image/${hash}`;
+ let deleteToken = res.files[0].delete_token;
+ let deleteUrl = `${window.location.origin}/pictrs/image/delete/${deleteToken}/${hash}`;
i.state.postForm.url = url;
i.state.imageLoading = false;
i.setState(i.state);
+ pictrsDeleteToast(
+ i18n.t('click_to_delete_picture'),
+ i18n.t('picture_deleted'),
+ deleteUrl
+ );
} else {
i.state.imageLoading = false;
i.setState(i.state);