屏蔽词作用于评论区 && 非列表模式可看被屏蔽洞 && 修复折叠时未隐藏被屏蔽洞
This commit is contained in:
@@ -29,7 +29,7 @@ const DEFAULT_CONFIG = {
|
|||||||
pressure: false,
|
pressure: false,
|
||||||
easter_egg: true,
|
easter_egg: true,
|
||||||
color_scheme: 'default',
|
color_scheme: 'default',
|
||||||
block_words_v2: ['#天火', '#桃花石'],
|
block_words_v3: ['蜘蛛'],
|
||||||
whitelist_cw: [],
|
whitelist_cw: [],
|
||||||
ipfs_gateway_list: [
|
ipfs_gateway_list: [
|
||||||
'https://<hash>.ipfs.dweb.link/',
|
'https://<hash>.ipfs.dweb.link/',
|
||||||
@@ -64,9 +64,9 @@ export function load_config() {
|
|||||||
if (config[key] !== undefined) config[key] = loaded_config[key];
|
if (config[key] !== undefined) config[key] = loaded_config[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (loaded_config['block_words']) {
|
if (loaded_config['block_words_v2']) {
|
||||||
config['block_words_v2'] = loaded_config['block_words'].concat(
|
config['block_words_v3'] = loaded_config['block_words_v2'].concat(
|
||||||
config['block_words_v2'],
|
config['block_words_v3'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ export class ConfigUI extends PureComponent {
|
|||||||
callback={this.save_changes_bound}
|
callback={this.save_changes_bound}
|
||||||
/> */}
|
/> */}
|
||||||
<ConfigTextArea
|
<ConfigTextArea
|
||||||
id="block_words_v2"
|
id="block_words_v3"
|
||||||
callback={this.save_changes_bound}
|
callback={this.save_changes_bound}
|
||||||
name="设置屏蔽词"
|
name="设置屏蔽词"
|
||||||
description={'包含屏蔽词的树洞会被折叠,每行写一个屏蔽词'}
|
description={'包含屏蔽词的树洞会被折叠,每行写一个屏蔽词'}
|
||||||
|
|||||||
29
src/Flows.js
29
src/Flows.js
@@ -99,7 +99,11 @@ class Reply extends PureComponent {
|
|||||||
search_param,
|
search_param,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const author = info.name,
|
const author = info.name,
|
||||||
replyText = info.text;
|
replyText = info.text,
|
||||||
|
has_block_words =
|
||||||
|
window.config.block_words_v3.some((word) => info.text.includes(word)) &&
|
||||||
|
!info.can_del;
|
||||||
|
this.color_picker = new ColorPicker();
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={'flow-reply box'}
|
className={'flow-reply box'}
|
||||||
@@ -165,7 +169,9 @@ class Reply extends PureComponent {
|
|||||||
)}
|
)}
|
||||||
<Time stamp={info.timestamp} short={!do_report} />
|
<Time stamp={info.timestamp} short={!do_report} />
|
||||||
|
|
||||||
|
{has_block_words && <span className="box-header-badge">已屏蔽</span>}
|
||||||
</div>
|
</div>
|
||||||
|
{!has_block_words && (
|
||||||
<div className="box-content">
|
<div className="box-content">
|
||||||
<HighlightedMarkdown
|
<HighlightedMarkdown
|
||||||
author={author}
|
author={author}
|
||||||
@@ -175,6 +181,7 @@ class Reply extends PureComponent {
|
|||||||
search_param={search_param}
|
search_param={search_param}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -850,11 +857,13 @@ class FlowItemRow extends PureComponent {
|
|||||||
super(props);
|
super(props);
|
||||||
this.needFold =
|
this.needFold =
|
||||||
props.info.cw &&
|
props.info.cw &&
|
||||||
!props.search_param &&
|
|
||||||
window.config.whitelist_cw.indexOf('*') == -1 &&
|
window.config.whitelist_cw.indexOf('*') == -1 &&
|
||||||
window.config.whitelist_cw.indexOf(props.info.cw) == -1 &&
|
window.config.whitelist_cw.indexOf(props.info.cw) == -1 &&
|
||||||
props.mode !== 'attention' &&
|
props.mode === 'list';
|
||||||
props.mode !== 'attention_finished';
|
this.has_block_words =
|
||||||
|
window.config.block_words_v3.some((word) =>
|
||||||
|
props.info.text.includes(word),
|
||||||
|
) && !props.info.can_del;
|
||||||
this.color_picker = new ColorPicker();
|
this.color_picker = new ColorPicker();
|
||||||
this.state = {
|
this.state = {
|
||||||
replies: props.info.comments
|
replies: props.info.comments
|
||||||
@@ -863,12 +872,6 @@ class FlowItemRow extends PureComponent {
|
|||||||
reply_status: 'done',
|
reply_status: 'done',
|
||||||
reply_error: null,
|
reply_error: null,
|
||||||
info: Object.assign({}, props.info, { variant: {} }),
|
info: Object.assign({}, props.info, { variant: {} }),
|
||||||
hidden:
|
|
||||||
(window.config.block_words_v2.some((word) =>
|
|
||||||
props.info.text.includes(word),
|
|
||||||
) &&
|
|
||||||
!props.info.can_del) ||
|
|
||||||
this.needFold,
|
|
||||||
attention: props.info.attention,
|
attention: props.info.attention,
|
||||||
cached: true, // default no display anything
|
cached: true, // default no display anything
|
||||||
};
|
};
|
||||||
@@ -954,7 +957,7 @@ class FlowItemRow extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { show_sidebar, token, search_param, is_quote } = this.props;
|
const { show_sidebar, token, search_param, is_quote, mode } = this.props;
|
||||||
let show_pid = load_single_meta(show_sidebar, token, [this.state.info.pid]);
|
let show_pid = load_single_meta(show_sidebar, token, [this.state.info.pid]);
|
||||||
|
|
||||||
let hl_rules = [['pid', PID_RE]];
|
let hl_rules = [['pid', PID_RE]];
|
||||||
@@ -1042,9 +1045,9 @@ class FlowItemRow extends PureComponent {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.state.hidden) {
|
if (this.needFold || this.has_block_words) {
|
||||||
return (
|
return (
|
||||||
this.needFold && (
|
(!this.has_block_words || mode !== 'list') && (
|
||||||
<div
|
<div
|
||||||
className="flow-item-row flow-item-row-with-prompt"
|
className="flow-item-row flow-item-row-with-prompt"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user