about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2019-09-18 11:02:21 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-09-18 04:02:21 +0200
commit0627252b30d9f420d51bb4787c539550d68a717a (patch)
treee6e7d9f1027fd0d8be7e7dbf5406e5f5e7648eed /app
parenta4b60e9ba4874b9ab427bec41d8b2cd252ec4782 (diff)
Check existence of timeline state in community timeline (#11880)
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/features/community_timeline/index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/community_timeline/index.js b/app/javascript/mastodon/features/community_timeline/index.js
index cb93f9c22..30153cc15 100644
--- a/app/javascript/mastodon/features/community_timeline/index.js
+++ b/app/javascript/mastodon/features/community_timeline/index.js
@@ -18,9 +18,10 @@ const mapStateToProps = (state, { onlyMedia, columnId }) => {
   const uuid = columnId;
   const columns = state.getIn(['settings', 'columns']);
   const index = columns.findIndex(c => c.get('uuid') === uuid);
+  const timelineState = state.getIn(['timelines', `community${onlyMedia ? ':media' : ''}`]);
 
   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']),
   };
 };