mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
Merge branch 'comment/delete' of https://github.com/esteemapp/esteem-mobile into comment/delete
This commit is contained in:
commit
62f44a2524
@ -44,6 +44,7 @@ class CommentView extends PureComponent {
|
||||
commentNumber,
|
||||
currentAccountUsername,
|
||||
fetchPost,
|
||||
handleDeleteComment,
|
||||
handleOnEditPress,
|
||||
handleOnReplyPress,
|
||||
handleOnUserPress,
|
||||
@ -95,6 +96,14 @@ class CommentView extends PureComponent {
|
||||
iconType="MaterialIcons"
|
||||
/>
|
||||
)}
|
||||
<IconButton
|
||||
size={18}
|
||||
iconStyle={styles.leftIcon}
|
||||
style={styles.leftButton}
|
||||
name="delete-forever"
|
||||
onPress={() => handleDeleteComment && handleDeleteComment(comment.author, comment.permlink)}
|
||||
iconType="MaterialIcons"
|
||||
/>
|
||||
</Fragment>
|
||||
)}
|
||||
{isShowMoreButton && (
|
||||
|
@ -2,7 +2,7 @@ import React, { Component } from 'react';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { getComments } from '../../../providers/steem/dsteem';
|
||||
import { getComments, deleteComment } from '../../../providers/steem/dsteem';
|
||||
|
||||
// Services and Actions
|
||||
|
||||
@ -153,6 +153,10 @@ class CommentsContainer extends Component {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
_handleDeleteComment = (author, permlink) => {
|
||||
deleteComment(author, permlink);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { comments: _comments, selectedPermlink } = this.state;
|
||||
@ -184,6 +188,7 @@ class CommentsContainer extends Component {
|
||||
handleOnReplyPress={this._handleOnReplyPress}
|
||||
isLoggedIn={isLoggedIn}
|
||||
fetchPost={fetchPost}
|
||||
handleDeleteComment={this._handleDeleteComment}
|
||||
{...this.props}
|
||||
/>
|
||||
);
|
||||
|
@ -38,6 +38,7 @@ class CommentsView extends PureComponent {
|
||||
isLoggedIn,
|
||||
isShowSubComments,
|
||||
marginLeft,
|
||||
handleDeleteComment,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -50,6 +51,7 @@ class CommentsView extends PureComponent {
|
||||
comment={item}
|
||||
commentCount={commentCount || item.children}
|
||||
commentNumber={commentNumber}
|
||||
handleDeleteComment={handleDeleteComment}
|
||||
currentAccountUsername={currentAccountUsername}
|
||||
fetchPost={fetchPost}
|
||||
handleOnEditPress={handleOnEditPress}
|
||||
|
@ -341,6 +341,19 @@ export const getPurePost = async (author, permlink) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const deleteComment = (author, permlink) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
client.database
|
||||
.call('comment_delete', [author, permlink])
|
||||
.then((response) => {
|
||||
resolve(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @method getUser get user data
|
||||
* @param user post author
|
||||
|
Loading…
Reference in New Issue
Block a user