about summary refs log tree commit diff
path: root/app/javascript/flavours
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2019-09-18 11:02:21 +0900
committerThibaut Girka <thib@sitedethib.com>2019-09-18 17:27:51 +0200
commit844e0fb48ce8b5344b75ae037a5ece8032b4220c (patch)
tree139239a6fe97f3b6f982c4c1871ad9239c50e25c /app/javascript/flavours
parent8b00cf519eacbb783678aa1c52da26fb8e1314db (diff)
[Glitch] Check existence of timeline state in community timeline
Port 0627252b30d9f420d51bb4787c539550d68a717a to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r--app/javascript/flavours/glitch/features/community_timeline/index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/community_timeline/index.js b/app/javascript/flavours/glitch/features/community_timeline/index.js
index 11b67fa6a..5585edc9c 100644
--- a/app/javascript/flavours/glitch/features/community_timeline/index.js
+++ b/app/javascript/flavours/glitch/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']),
   };
 };