Removed open thread menu item from post comments

This commit is contained in:
Mustafa Buyukcelebi 2019-09-02 15:37:23 +03:00
parent 6a031b2a57
commit cdbb7d833c
2 changed files with 15 additions and 13 deletions

View File

@ -196,7 +196,7 @@ class CommentsContainer extends Component {
};
_handleOnPressCommentMenu = (index, selectedComment) => {
const { dispatch, intl, navigation } = this.props;
const { dispatch, intl, navigation, isOwnProfile } = this.props;
switch (index) {
case 0:
@ -211,6 +211,7 @@ class CommentsContainer extends Component {
});
break;
case 1:
case isOwnProfile:
navigation.navigate({
routeName: ROUTES.SCREENS.POST,
key: get(selectedComment, 'permlink'),
@ -241,6 +242,7 @@ class CommentsContainer extends Component {
selectedFilter,
mainAuthor,
selectedPermlink: _selectedPermlink,
isOwnProfile,
} = this.props;
return (
@ -261,6 +263,7 @@ class CommentsContainer extends Component {
fetchPost={fetchPost}
handleDeleteComment={this._handleDeleteComment}
handleOnPressCommentMenu={this._handleOnPressCommentMenu}
isOwnProfile={isOwnProfile}
/>
);
}

View File

@ -55,9 +55,18 @@ class CommentsView extends Component {
handleOnPressCommentMenu,
handleOnVotersPress,
intl,
isOwnProfile,
} = this.props;
const { selectedComment } = this.state;
const menuItems = isOwnProfile
? [
intl.formatMessage({ id: 'post.copy_link' }),
intl.formatMessage({ id: 'post.open_thread' }),
intl.formatMessage({ id: 'alert.cancel' }),
]
: [intl.formatMessage({ id: 'post.copy_link' }), intl.formatMessage({ id: 'alert.cancel' })];
return (
<Fragment>
<FlatList
@ -90,19 +99,9 @@ class CommentsView extends Component {
/>
<ActionSheet
ref={this.commentMenu}
options={[
intl.formatMessage({
id: 'post.copy_link',
}),
intl.formatMessage({
id: 'post.open_thread',
}),
intl.formatMessage({
id: 'alert.cancel',
}),
]}
options={menuItems}
title={get(selectedComment, 'summary')}
cancelButtonIndex={2}
cancelButtonIndex={isOwnProfile ? 2 : 1}
onPress={index => handleOnPressCommentMenu(index, selectedComment)}
/>
</Fragment>