Merge pull request #915 from esteemapp/bugfix/reblog-option

Removed reblog option from reblogged posts
This commit is contained in:
Mustafa Buyukcelebi 2019-06-21 11:33:53 +03:00 committed by GitHub
commit 55e6306db7
5 changed files with 25 additions and 13 deletions

View File

@ -82,7 +82,7 @@ class PostCardContainer extends PureComponent {
};
render() {
const { content, isHideImage, nsfw } = this.props;
const { content, isHideImage, nsfw, isHideReblogOption } = this.props;
const { _content } = this.state;
const isNsfwPost = nsfw === '1';
@ -96,6 +96,7 @@ class PostCardContainer extends PureComponent {
content={_content || content}
isHideImage={isHideImage}
isNsfwPost={isNsfwPost}
isHideReblogOption={isHideReblogOption}
/>
);
}

View File

@ -68,7 +68,7 @@ class PostCardView extends Component {
};
render() {
const { content, isHideImage, fetchPost, isNsfwPost } = this.props;
const { content, isHideImage, fetchPost, isNsfwPost, isHideReblogOption } = this.props;
const _image = this._getPostImage(content, isNsfwPost);
const reblogedBy = content.reblogged_by && content.reblogged_by[0];
@ -88,7 +88,11 @@ class PostCardView extends Component {
reblogedBy={reblogedBy}
/>
<View style={styles.dropdownWrapper}>
<PostDropdown content={content} fetchPost={fetchPost} />
<PostDropdown
isHideReblogOption={isHideReblogOption}
content={content}
fetchPost={fetchPost}
/>
</View>
</View>
<View style={styles.postBodyWrapper}>

View File

@ -173,10 +173,10 @@ class PostDropdownContainer extends PureComponent {
};
render() {
const { intl, currentAccount, content } = this.props;
const { intl, currentAccount, content, isHideReblogOption } = this.props;
let _OPTIONS = OPTIONS;
if (content && content.author === currentAccount.name) {
if ((content && content.author === currentAccount.name) || isHideReblogOption) {
_OPTIONS = OPTIONS.filter(item => item !== 'reblog');
}

View File

@ -228,6 +228,7 @@ class PostsView extends Component {
isLoginDone,
tag,
isDarkTheme,
isHideReblogOption,
} = this.props;
return (
@ -262,7 +263,12 @@ class PostsView extends Component {
data={posts}
showsVerticalScrollIndicator={false}
renderItem={({ item }) => (
<PostCard isRefresh={refreshing} content={item} isHideImage={isHideImage} />
<PostCard
isHideReblogOption={isHideReblogOption}
isRefresh={refreshing}
content={item}
isHideImage={isHideImage}
/>
)}
keyExtractor={(post, index) => index.toString()}
onEndReached={() => this._loadPosts()}
@ -275,13 +281,13 @@ class PostsView extends Component {
onScrollBeginDrag={() => this._handleOnScrollStart()}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={this._handleOnRefreshPosts}
progressBackgroundColor="#357CE6"
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
titleColor="#fff"
colors={['#fff']}
/>
refreshing={refreshing}
onRefresh={this._handleOnRefreshPosts}
progressBackgroundColor="#357CE6"
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
titleColor="#fff"
colors={['#fff']}
/>
}
ref={ref => {
this.flatList = ref;

View File

@ -206,6 +206,7 @@ class ProfileScreen extends PureComponent {
tag={username}
key={username}
handleOnScroll={this._handleOnScroll}
isHideReblogOption
/>
</View>
<View