Merge pull request #1127 from esteemapp/bugfix/comment-open-thread

Removed open thread menu item from post comments
This commit is contained in:
uğur erdal 2019-09-02 21:47:35 +03:00 committed by GitHub
commit 32022d769c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

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

View File

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