about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/public_timeline/index.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-11-10 23:05:02 +0100
committerThibaut Girka <thib@sitedethib.com>2019-11-20 17:56:35 +0100
commit64225f4ac2a922c27692e8326757ec8dc83a1cc8 (patch)
tree6aae4bdb24b8862f78377e7b52596c808aad5884 /app/javascript/flavours/glitch/features/public_timeline/index.js
parent1064a9d827b5ec773e13c9bd10459f598b6ef84f (diff)
[Glitch] Fix unread toot indicator not honoring onlyMedia in public and community timelines
Port 0d6da8892a675962f8e7fe1f1edc960c4a0ce36d to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/public_timeline/index.js')
-rw-r--r--app/javascript/flavours/glitch/features/public_timeline/index.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/public_timeline/index.js b/app/javascript/flavours/glitch/features/public_timeline/index.js
index 49a5011c0..4d139a326 100644
--- a/app/javascript/flavours/glitch/features/public_timeline/index.js
+++ b/app/javascript/flavours/glitch/features/public_timeline/index.js
@@ -14,14 +14,16 @@ const messages = defineMessages({
   title: { id: 'column.public', defaultMessage: 'Federated timeline' },
 });
 
-const mapStateToProps = (state, { onlyMedia, columnId }) => {
+const mapStateToProps = (state, { columnId }) => {
   const uuid = columnId;
   const columns = state.getIn(['settings', 'columns']);
   const index = columns.findIndex(c => c.get('uuid') === uuid);
+  const onlyMedia = (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'public', 'other', 'onlyMedia']);
+  const timelineState = state.getIn(['timelines', `public${onlyMedia ? ':media' : ''}`]);
 
   return {
-    hasUnread: state.getIn(['timelines', `public${onlyMedia ? ':media' : ''}`, 'unread']) > 0,
-    onlyMedia: (columnId && index >= 0) ? columns.get(index).getIn(['params', 'other', 'onlyMedia']) : state.getIn(['settings', 'public', 'other', 'onlyMedia']),
+    hasUnread: !!timelineState && timelineState.get('unread') > 0,
+    onlyMedia,
   };
 };