Browse Source

reverse replies for reply timeline

master
hole-thu 2 years ago
parent
commit
ed582ebde5
  1. 36
      src/Flows.js

36
src/Flows.js

@ -1083,7 +1083,8 @@ class FlowItemRow extends PureComponent {
} }
render() { render() {
const { show_sidebar, token, search_param, is_quote, mode } = this.props; const { show_sidebar, token, search_param, is_quote, mode, submode } =
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]];
@ -1108,6 +1109,11 @@ class FlowItemRow extends PureComponent {
} }
} }
let replies_to_show = this.state.replies.slice(0, PREVIEW_REPLY_COUNT);
if (mode === 'list' && submode === 1) {
replies_to_show.reverse();
}
let res = ( let res = (
<div <div
className={ className={
@ -1150,20 +1156,18 @@ class FlowItemRow extends PureComponent {
<p>{this.state.reply_error}</p> <p>{this.state.reply_error}</p>
</div> </div>
)} )}
{this.state.replies {replies_to_show.map(
.slice(0, PREVIEW_REPLY_COUNT) (reply) =>
.map( (reply.can_del || !reply.is_blocked) && (
(reply) => <Reply
(reply.can_del || !reply.is_blocked) && ( key={reply.cid}
<Reply info={reply}
key={reply.cid} color_picker={this.color_picker}
info={reply} show_pid={show_pid}
color_picker={this.color_picker} search_param={search_param}
show_pid={show_pid} />
search_param={search_param} ),
/> )}
),
)}
{this.state.replies.length > PREVIEW_REPLY_COUNT && ( {this.state.replies.length > PREVIEW_REPLY_COUNT && (
<div className="box box-tip"> <div className="box box-tip">
还有 {this.state.replies.length - PREVIEW_REPLY_COUNT} 还有 {this.state.replies.length - PREVIEW_REPLY_COUNT}
@ -1367,6 +1371,7 @@ function FlowChunk(props) {
<FlowItemRow <FlowItemRow
info={info} info={info}
mode={props.mode} mode={props.mode}
submode={props.submode}
show_sidebar={props.show_sidebar} show_sidebar={props.show_sidebar}
token={token} token={token}
deletion_detect={props.deletion_detect} deletion_detect={props.deletion_detect}
@ -1789,6 +1794,7 @@ class SubFlow extends PureComponent {
title={chunks.title} title={chunks.title}
list={chunks.data} list={chunks.data}
mode={mode} mode={mode}
submode={submode}
search_param={search_param || null} search_param={search_param || null}
show_sidebar={show_sidebar} show_sidebar={show_sidebar}
deletion_detect={should_deletion_detect} deletion_detect={should_deletion_detect}

Loading…
Cancel
Save