about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-10-02 16:01:28 +0200
committerThibG <thib@sitedethib.com>2018-10-02 22:00:57 +0200
commita9e8f98a9d32c57956d41009bd09a1f33310676e (patch)
tree3bd7c0c40cb7a59dbe23fabfe1ad6c3a7f0becba /app/javascript/flavours/glitch/features/account_gallery/components/media_item.js
parentd82c495c0fcfe259f0b52386349a01a89c3e13cb (diff)
Make hidden media clickable in account media gallery
Diffstat (limited to 'app/javascript/flavours/glitch/features/account_gallery/components/media_item.js')
-rw-r--r--app/javascript/flavours/glitch/features/account_gallery/components/media_item.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js
index 3740b614f..89778e123 100644
--- a/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js
+++ b/app/javascript/flavours/glitch/features/account_gallery/components/media_item.js
@@ -14,6 +14,15 @@ export default class MediaItem extends ImmutablePureComponent {
     visible: displayMedia !== 'hide_all' && !this.props.media.getIn(['status', 'sensitive']) || displayMedia === 'show_all',
   };
 
+  handleClick = () => {
+    if (!this.state.visible) {
+      this.setState({ visible: true });
+      return true;
+    }
+
+    return false;
+  }
+
   render () {
     const { media } = this.props;
     const { visible } = this.state;
@@ -50,6 +59,7 @@ export default class MediaItem extends ImmutablePureComponent {
           href={status.get('url')}
           style={style}
           title={title}
+          onInterceptClick={this.handleClick}
         >
           {icon}
           {label}