mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 04:41:43 +03:00
Fixed comment filter issue
This commit is contained in:
parent
536c7424b3
commit
bb4dd26a2e
@ -51,9 +51,11 @@ class CommentsContainer extends Component {
|
||||
|
||||
// Component Functions
|
||||
|
||||
_shortComments = sortOrder => {
|
||||
_shortComments = (sortOrder, comments) => {
|
||||
const { comments: parent } = this.state;
|
||||
|
||||
const sortedComments = comments || parent;
|
||||
|
||||
const allPayout = c =>
|
||||
parseFloat(get(c, 'pending_payout_value').split(' ')[0]) +
|
||||
parseFloat(get(c, 'total_payout_value').split(' ')[0]) +
|
||||
@ -116,23 +118,31 @@ class CommentsContainer extends Component {
|
||||
},
|
||||
};
|
||||
|
||||
parent.sort(sortOrders[sortOrder]);
|
||||
sortedComments.sort(sortOrders[sortOrder]);
|
||||
|
||||
return parent;
|
||||
return sortedComments;
|
||||
};
|
||||
|
||||
_getComments = async () => {
|
||||
const {
|
||||
author,
|
||||
permlink,
|
||||
selectedFilter,
|
||||
currentAccount: { name },
|
||||
} = this.props;
|
||||
|
||||
await getComments(author, permlink, name)
|
||||
.then(comments => {
|
||||
if (selectedFilter && selectedFilter !== 'TRENDING') {
|
||||
const sortComments = this._shortComments(selectedFilter, comments);
|
||||
this.setState({
|
||||
comments: sortComments,
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
comments,
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user