1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-11 21:29:17 +09:00

[Glitch] Check existence of timeline state in community timeline

Port 0627252b30 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
Yamagishi Kazutoshi 2019-09-18 11:02:21 +09:00 committed by Thibaut Girka
parent 8b00cf519e
commit 844e0fb48c

View File

@ -18,9 +18,10 @@ const mapStateToProps = (state, { onlyMedia, columnId }) => {
const uuid = columnId; const uuid = columnId;
const columns = state.getIn(['settings', 'columns']); const columns = state.getIn(['settings', 'columns']);
const index = columns.findIndex(c => c.get('uuid') === uuid); const index = columns.findIndex(c => c.get('uuid') === uuid);
const timelineState = state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`]);
return { return {
hasUnread: state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`, 'unread']) > 0 || state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`, 'pendingItems']).size > 0, hasUnread: !!timelineState && (timelineState.get('unread') > 0 || timelineState.get('pendingItems').size > 0),
onlyMedia: (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'community', 'other', 'onlyMedia']), onlyMedia: (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'community', 'other', 'onlyMedia']),
}; };
}; };