diff --git a/src/Flows.js b/src/Flows.js
index 15eb668..ead8e33 100644
--- a/src/Flows.js
+++ b/src/Flows.js
@@ -96,7 +96,10 @@ class Reply extends PureComponent {
}
render() {
- const {info, color_picker, show_pid, do_filter_name, do_delete} = this.props;
+ const {
+ info, color_picker, show_pid, do_filter_name, do_delete,
+ do_report, do_block
+ } = this.props;
const author = info.name,
replyText = info.text;
return (
@@ -127,19 +130,42 @@ class Reply extends PureComponent {
{info.name}
)}
{!!do_delete && !!info.can_del && (
- {
- do_delete('cid', info.cid);
- }}
- >
-
-
+ <>
+ {
+ do_delete('cid', info.cid);
+ }}
+ >
+
+
+
+ >
)}
+ {!!do_block && (
+ <>
+
+
+
+
+ >
+ )}
+ {!!do_report && (
+ <>
+
+
+
+
+ >
+ )}
+
-
-
- {'$' + info.cid}
)}
+ {!!do_block && (
+
+
+
+ )}
{info.cw !== null &&
(!do_edit_cw || !info.can_del) && (
@@ -540,8 +574,8 @@ class FlowSidebar extends PureComponent {
});
}
- report() {
- let reason = prompt(`举报 #${this.state.info.pid} 的理由:`);
+ report(text = '') {
+ let reason = prompt(`举报 #${this.state.info.pid} 的理由:`, text);
if (reason !== null) {
API.report(this.state.info.pid, reason, this.props.token)
.then((json) => {
@@ -554,6 +588,21 @@ class FlowSidebar extends PureComponent {
}
}
+ block(name, type, id, on_complete) {
+ if (confirm(`确定拉黑${name}吗?后续将不会收到其发布的任何内容`)) {
+ API.block(type, id, this.props.token)
+ .then((json) => {
+ let data = json.data;
+ alert(`操作成功,其成为危险用户进度 ${data.curr}/${data.threshold}`)
+ !!on_complete && on_complete();
+ })
+ .catch((e) => {
+ alert('拉黑失败');
+ console.error(e)
+ });
+ }
+ }
+
set_filter_name(name) {
this.setState((prevState) => ({
filter_name: name === prevState.filter_name ? null : name,
@@ -674,6 +723,9 @@ class FlowSidebar extends PureComponent {
do_edit_cw={this.make_do_edit_cw(this.props.token)}
do_edit_score={this.make_do_edit_score(this.props.token)}
do_vote={this.do_vote.bind(this)}
+ do_block={() => {this.block(
+ '洞主', 'post', this.state.info.pid, () => {window.location.reload();}
+ )}}
/>
);
@@ -763,7 +815,7 @@ class FlowSidebar extends PureComponent {
条回复被删除
)}
- {replies_to_show.map((reply, i) => (
+ {replies_to_show.map((reply, i) => !reply.blocked && (
{this.block(
+ reply.name, 'comment', reply.cid, this.load_replies.bind(this)
+ )}}
+ do_report={() => {this.report(`评论区${reply.name},评论id ${reply.cid}`)}}
/>
@@ -988,7 +1044,7 @@ class FlowItemRow extends PureComponent {
{this.state.reply_error}
)}
- {this.state.replies.slice(0, PREVIEW_REPLY_COUNT).map((reply) => (
+ {this.state.replies.slice(0, PREVIEW_REPLY_COUNT).map((reply) => !reply.blocked && (
(
{!!props.title &&
}
- {props.list.map((info, ind) => (
+ {props.list.map((info, ind) => !info.blocked && (
{submode_names.map((name, idx) => (
-
))}
-
+
{
+ let data = new URLSearchParams([
+ ['type', type], ['id', id]
+ ]);
+ let response = await fetch(
+ API_BASE + '/block',
+ {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'User-Token': token,
+ },
+ body: data,
+ },
+ );
+ return handle_response(response, true);
+ },
+
+
del: async (type, id, note, token) => {
let data = new URLSearchParams();
data.append('type', type);
diff --git a/src/fonts_7/icomoon.css b/src/fonts_7/icomoon.css
index 72bb343..5dc1726 100644
--- a/src/fonts_7/icomoon.css
+++ b/src/fonts_7/icomoon.css
@@ -111,3 +111,7 @@
.icon-trash:before {
content: "\1f5d1";
}
+
+.icon-block:before {
+ content: "\1F6C7";
+}