mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 05:42:33 +03:00
Fixed reply delete issue
This commit is contained in:
parent
8ab1989e5c
commit
9ab3529acd
@ -129,8 +129,13 @@ class CommentsContainer extends Component {
|
||||
permlink,
|
||||
selectedFilter,
|
||||
currentAccount: { name },
|
||||
isOwnProfile,
|
||||
fetchPost,
|
||||
} = this.props;
|
||||
|
||||
if (isOwnProfile) {
|
||||
fetchPost();
|
||||
} else {
|
||||
await getComments(author, permlink, name)
|
||||
.then(comments => {
|
||||
if (selectedFilter && selectedFilter !== 'TRENDING') {
|
||||
@ -145,6 +150,7 @@ class CommentsContainer extends Component {
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnReplyPress = item => {
|
||||
@ -175,10 +181,17 @@ class CommentsContainer extends Component {
|
||||
};
|
||||
|
||||
_handleDeleteComment = permlink => {
|
||||
const { currentAccount, pinCode } = this.props;
|
||||
const { currentAccount, pinCode, comments } = this.props;
|
||||
const { comments: _comments } = this.state;
|
||||
let filteredComments;
|
||||
|
||||
deleteComment(currentAccount, pinCode, permlink).then(() => {
|
||||
this._getComments();
|
||||
if (_comments.length > 0) {
|
||||
filteredComments = _comments.filter(item => item.permlink !== permlink);
|
||||
} else {
|
||||
filteredComments = comments.filter(item => item.permlink !== permlink);
|
||||
}
|
||||
this.setState({ comments: filteredComments });
|
||||
});
|
||||
};
|
||||
|
||||
@ -240,7 +253,7 @@ class CommentsContainer extends Component {
|
||||
isShowMoreButton={isShowMoreButton}
|
||||
commentNumber={commentNumber || 1}
|
||||
commentCount={commentCount}
|
||||
comments={_comments || comments}
|
||||
comments={_comments.length > 0 ? _comments : comments}
|
||||
currentAccountUsername={currentAccount.name}
|
||||
handleOnEditPress={this._handleOnEditPress}
|
||||
handleOnReplyPress={this._handleOnReplyPress}
|
||||
@ -248,7 +261,6 @@ class CommentsContainer extends Component {
|
||||
fetchPost={fetchPost}
|
||||
handleDeleteComment={this._handleDeleteComment}
|
||||
handleOnPressCommentMenu={this._handleOnPressCommentMenu}
|
||||
{...this.props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { PureComponent, Fragment } from 'react';
|
||||
import React, { Component, Fragment } from 'react';
|
||||
import { FlatList } from 'react-native';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
import get from 'lodash/get';
|
||||
@ -11,7 +11,7 @@ import { Comment } from '../../comment';
|
||||
// Styles
|
||||
import styles from './commentStyles';
|
||||
|
||||
class CommentsView extends PureComponent {
|
||||
class CommentsView extends Component {
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { type } name - Description....
|
||||
|
@ -373,7 +373,7 @@ export const deleteComment = (currentAccount, pin, permlink) => {
|
||||
const key = getAnyPrivateKey(currentAccount.local, digitPinCode);
|
||||
|
||||
if (currentAccount.local.authType === AUTH_TYPE.STEEM_CONNECT) {
|
||||
const token = decryptKey(currentAccount.accessToken, pin);
|
||||
const token = decryptKey(currentAccount.local.accessToken, digitPinCode);
|
||||
const api = steemConnect.Initialize({
|
||||
accessToken: token,
|
||||
});
|
||||
|
@ -226,7 +226,12 @@ class ProfileScreen extends PureComponent {
|
||||
>
|
||||
{comments && comments.length > 0 ? (
|
||||
<ScrollView onScroll={this._handleOnScroll}>
|
||||
<Comments isProfilePreview comments={comments} fetchPost={getReplies} />
|
||||
<Comments
|
||||
isProfilePreview
|
||||
comments={comments}
|
||||
fetchPost={getReplies}
|
||||
isOwnProfile={!isReverseHeader}
|
||||
/>
|
||||
</ScrollView>
|
||||
) : (
|
||||
<NoPost
|
||||
|
Loading…
Reference in New Issue
Block a user