Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add early prevention for suicide #18

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/UserAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down