about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-10-02 15:54:25 +0200
committerThibG <thib@sitedethib.com>2018-10-02 22:00:57 +0200
commitd82c495c0fcfe259f0b52386349a01a89c3e13cb (patch)
tree034fa299eea77c7472d60693de5859651cd2cd5a /app/javascript/flavours/glitch
parentbd1f08fa9a15ce1d40760b0321c370cb38232397 (diff)
Add media description (or status spoiler) in account media gallery
Diffstat (limited to 'app/javascript/flavours/glitch')
-rw-r--r--app/javascript/flavours/glitch/features/account_gallery/components/media_item.js11
1 files changed, 9 insertions, 2 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 2e48ab799..3740b614f 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
@@ -24,7 +24,7 @@ export default class MediaItem extends ImmutablePureComponent {
     const y = ((focusY / -2) + .5) * 100;
     const style = {};
 
-    let label, icon;
+    let label, icon, title;
 
     if (media.get('type') === 'gifv') {
       label = <span className='media-gallery__gifv__label'>GIF</span>;
@@ -33,17 +33,24 @@ export default class MediaItem extends ImmutablePureComponent {
     if (visible) {
       style.backgroundImage    = `url(${media.get('preview_url')})`;
       style.backgroundPosition = `${x}% ${y}%`;
+      title                    = media.get('description');
     } else {
       icon = (
         <span className='account-gallery__item__icons'>
           <i className='fa fa-eye-slash' />
         </span>
       );
+      title = status.get('spoiler_text') || media.get('description');
     }
 
     return (
       <div className='account-gallery__item'>
-        <Permalink to={`/statuses/${status.get('id')}`} href={status.get('url')} style={style}>
+        <Permalink
+          to={`/statuses/${status.get('id')}`}
+          href={status.get('url')}
+          style={style}
+          title={title}
+        >
           {icon}
           {label}
         </Permalink>