举报时手动选择是否隐藏
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<title>新T树洞</title>
|
||||
</head>
|
||||
<script>
|
||||
function force_reload() {
|
||||
function force_reload() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
.getRegistrations()
|
||||
|
||||
@@ -550,8 +550,9 @@ class FlowSidebar extends PureComponent {
|
||||
report(event, text = '') {
|
||||
console.log(text);
|
||||
let reason = prompt(`举报 #${this.state.info.pid} 的理由:`, text);
|
||||
let should_hide = confirm('是否认为此洞应该被删除或隐藏?');
|
||||
if (reason !== null) {
|
||||
API.report(this.state.info.pid, reason, this.props.token)
|
||||
API.report(this.state.info.pid, reason, should_hide, this.props.token)
|
||||
.then((json) => {
|
||||
alert('举报成功');
|
||||
})
|
||||
|
||||
@@ -80,10 +80,14 @@ export const API = {
|
||||
return handle_response(response, false);
|
||||
},
|
||||
|
||||
report: async (pid, reason, token) => {
|
||||
let data = new URLSearchParams();
|
||||
data.append('pid', pid);
|
||||
data.append('reason', reason);
|
||||
report: async (pid, reason, should_hide, token) => {
|
||||
let data = new URLSearchParams([
|
||||
['pid', pid],
|
||||
['reason', reason],
|
||||
]);
|
||||
if (should_hide) {
|
||||
data.append('should_hide', 1);
|
||||
}
|
||||
let response = await fetch(API_BASE + '/report', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user