From 77c6a3795fd34f5a01b059d6093909c16485ca9d Mon Sep 17 00:00:00 2001 From: mayeths Date: Sat, 31 Oct 2020 10:05:52 +0800 Subject: [PATCH] Add early prevention for suicide --- src/UserAction.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/UserAction.js b/src/UserAction.js index c694cae5..9233550c 100644 --- a/src/UserAction.js +++ b/src/UserAction.js @@ -825,6 +825,18 @@ export class PostForm extends Component { on_submit(event) { if (event) event.preventDefault(); if (this.state.loading_status === 'loading') return; + if (this.state.text.includes('自杀')) { + const msg = [ + '您提到了「自杀」\n', + '需要帮助?', + '北京24小时心理援助热线:010-8295-1332', + '希望24小时热线:400-161-9995', + '你不孤单,我们都在。\n', + '确认将继续发表' + ] + const result = confirm(msg.join('\n')) + if (result !== true) return + } if (this.img_ref.current.files.length) { this.setState({ loading_status: 'processing',