about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/public_timeline
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-11-10 23:05:02 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-11-11 00:05:02 +0200
commit0d6da8892a675962f8e7fe1f1edc960c4a0ce36d (patch)
tree1a2ae7a9a28680bb9f762b51875c5a5f51b3c21e /app/javascript/mastodon/features/public_timeline
parent0d5f3ae33135f2cae28c13df6bba63d396dd08cc (diff)
Fix unread toot indicator not honoring onlyMedia in public and community timelines (#12330)
* Fix unread toot indicator not honoring onlyMedia in public and community timelines

* Fixup: `unread` already accounts for new content in pending items
Diffstat (limited to 'app/javascript/mastodon/features/public_timeline')
-rw-r--r--app/javascript/mastodon/features/public_timeline/index.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/public_timeline/index.js b/app/javascript/mastodon/features/public_timeline/index.js
index e7825e236..7aabd7f6e 100644
--- a/app/javascript/mastodon/features/public_timeline/index.js
+++ b/app/javascript/mastodon/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,
   };
 };