mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +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
|
// Component Functions
|
||||||
|
|
||||||
_shortComments = sortOrder => {
|
_shortComments = (sortOrder, comments) => {
|
||||||
const { comments: parent } = this.state;
|
const { comments: parent } = this.state;
|
||||||
|
|
||||||
|
const sortedComments = comments || parent;
|
||||||
|
|
||||||
const allPayout = c =>
|
const allPayout = c =>
|
||||||
parseFloat(get(c, 'pending_payout_value').split(' ')[0]) +
|
parseFloat(get(c, 'pending_payout_value').split(' ')[0]) +
|
||||||
parseFloat(get(c, 'total_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 () => {
|
_getComments = async () => {
|
||||||
const {
|
const {
|
||||||
author,
|
author,
|
||||||
permlink,
|
permlink,
|
||||||
|
selectedFilter,
|
||||||
currentAccount: { name },
|
currentAccount: { name },
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
await getComments(author, permlink, name)
|
await getComments(author, permlink, name)
|
||||||
.then(comments => {
|
.then(comments => {
|
||||||
|
if (selectedFilter && selectedFilter !== 'TRENDING') {
|
||||||
|
const sortComments = this._shortComments(selectedFilter, comments);
|
||||||
|
this.setState({
|
||||||
|
comments: sortComments,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
comments,
|
comments,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user