Updated AccountTimeline, GroupTimeline to not include pinned posts in Gab Deck
• Updated: - AccountTimeline, GroupTimeline to not include pinned posts in Gab Deck
This commit is contained in:
parent
aa750565f0
commit
0e7a336e5c
@ -15,10 +15,10 @@ import Button from '../components/button'
|
|||||||
class AccountTimeline extends ImmutablePureComponent {
|
class AccountTimeline extends ImmutablePureComponent {
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
const { accountId, commentsOnly } = this.props
|
const { accountId, commentsOnly, isDeckConnected } = this.props
|
||||||
|
|
||||||
if (accountId && accountId !== -1) {
|
if (accountId && accountId !== -1) {
|
||||||
if (!commentsOnly) {
|
if (!commentsOnly && !isDeckConnected) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(accountId))
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class AccountTimeline extends ImmutablePureComponent {
|
|||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (nextProps.accountId && nextProps.accountId !== -1 && (nextProps.accountId !== this.props.accountId && nextProps.accountId) || nextProps.commentsOnly !== this.props.commentsOnly) {
|
if (nextProps.accountId && nextProps.accountId !== -1 && (nextProps.accountId !== this.props.accountId && nextProps.accountId) || nextProps.commentsOnly !== this.props.commentsOnly) {
|
||||||
if (!nextProps.commentsOnly) {
|
if (!nextProps.commentsOnly && !nextProps.isDeckConnected) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(nextProps.accountId))
|
this.props.dispatch(expandAccountFeaturedTimeline(nextProps.accountId))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +101,7 @@ const mapStateToProps = (state, { id, account, commentsOnly = false }) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
accountId,
|
accountId,
|
||||||
|
isDeckConnected: state.getIn(['deck', 'connected'], false),
|
||||||
statusIds: state.getIn(['timelines', `account:${path}`, 'items'], emptyList),
|
statusIds: state.getIn(['timelines', `account:${path}`, 'items'], emptyList),
|
||||||
featuredStatusIds: commentsOnly ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], emptyList),
|
featuredStatusIds: commentsOnly ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned`, 'items'], emptyList),
|
||||||
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading'], true),
|
isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading'], true),
|
||||||
@ -116,6 +117,7 @@ AccountTimeline.propTypes = {
|
|||||||
isLoading: PropTypes.bool,
|
isLoading: PropTypes.bool,
|
||||||
hasMore: PropTypes.bool,
|
hasMore: PropTypes.bool,
|
||||||
commentsOnly: PropTypes.bool,
|
commentsOnly: PropTypes.bool,
|
||||||
|
isDeckConnected: PropTypes.bool,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
isMe: PropTypes.bool.isRequired,
|
isMe: PropTypes.bool.isRequired,
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ class GroupTimeline extends ImmutablePureComponent {
|
|||||||
sortByValue,
|
sortByValue,
|
||||||
sortByTopValue,
|
sortByTopValue,
|
||||||
onlyMedia,
|
onlyMedia,
|
||||||
|
isDeckConnected,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
if (sortByValue !== GROUP_TIMELINE_SORTING_TYPE_NEWEST) {
|
if (sortByValue !== GROUP_TIMELINE_SORTING_TYPE_NEWEST) {
|
||||||
@ -43,7 +44,9 @@ class GroupTimeline extends ImmutablePureComponent {
|
|||||||
} else {
|
} else {
|
||||||
const sortBy = getSortBy(sortByValue, sortByTopValue, onlyMedia)
|
const sortBy = getSortBy(sortByValue, sortByTopValue, onlyMedia)
|
||||||
|
|
||||||
|
if (!isDeckConnected) {
|
||||||
this.props.onExpandGroupFeaturedTimeline(groupId)
|
this.props.onExpandGroupFeaturedTimeline(groupId)
|
||||||
|
}
|
||||||
this.props.onExpandGroupTimeline(groupId, { sortBy, onlyMedia })
|
this.props.onExpandGroupTimeline(groupId, { sortBy, onlyMedia })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,7 +60,7 @@ class GroupTimeline extends ImmutablePureComponent {
|
|||||||
this.props.onClearTimeline(`group:${this.props.groupId}`)
|
this.props.onClearTimeline(`group:${this.props.groupId}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevProps.groupId !== this.props.groupId) {
|
if (prevProps.groupId !== this.props.groupId && !this.props.isDeckConnected) {
|
||||||
this.props.onExpandGroupFeaturedTimeline(this.props.groupId)
|
this.props.onExpandGroupFeaturedTimeline(this.props.groupId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,6 +130,7 @@ const mapStateToProps = (state, props) => ({
|
|||||||
groupPinnedStatusIds: state.getIn(['timelines', `group:${props.params.id}:pinned`, 'items'], emptyList),
|
groupPinnedStatusIds: state.getIn(['timelines', `group:${props.params.id}:pinned`, 'items'], emptyList),
|
||||||
sortByValue: state.getIn(['group_lists', 'sortByValue']),
|
sortByValue: state.getIn(['group_lists', 'sortByValue']),
|
||||||
sortByTopValue: state.getIn(['group_lists', 'sortByTopValue']),
|
sortByTopValue: state.getIn(['group_lists', 'sortByTopValue']),
|
||||||
|
isDeckConnected: state.getIn(['deck', 'connected'], false),
|
||||||
})
|
})
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user