diff --git a/app/soapbox/features/ui/components/profile_media_panel.js b/app/soapbox/features/ui/components/profile_media_panel.js index 7d01a2f5a..2927c1a63 100644 --- a/app/soapbox/features/ui/components/profile_media_panel.js +++ b/app/soapbox/features/ui/components/profile_media_panel.js @@ -35,13 +35,16 @@ class ProfileMediaPanel extends ImmutablePureComponent { this.props.dispatch(expandAccountMediaTimeline(accountId)); } - render() { - const { attachments } = this.props; - const nineAttachments = attachments.slice(0, 9); + componentDidUpdate() { + const { account } = this.props; + const accountId = account.get('id'); + this.props.dispatch(expandAccountMediaTimeline(accountId)); + } - if (attachments.isEmpty()) { - return null; - } + render() { + const { attachments, account } = this.props; + const publicAttachments = attachments.filter(attachment => attachment.getIn(['status', 'visibility']) === 'public'); + const nineAttachments = publicAttachments.slice(0, 9); return (
@@ -51,18 +54,20 @@ class ProfileMediaPanel extends ImmutablePureComponent {
-
-
- {nineAttachments.map((attachment, index) => ( - - ))} + {account && +
+
+ {!nineAttachments.isEmpty() && nineAttachments.map((attachment, index) => ( + + ))} +
-
+ }
); };