about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-03-08 08:22:04 +0100
committerGitHub <noreply@github.com>2018-03-08 08:22:04 +0100
commit77406d3a092db48250a85984dde2f2cc81386146 (patch)
treecfc87602c62b3c60986edce0f57a8a84a7731625
parent510c9049c79f4eb1e082932ff067fdb4216d1039 (diff)
Display AttachmentList in notifications (#6693)
-rw-r--r--app/javascript/mastodon/components/attachment_list.js28
-rw-r--r--app/javascript/mastodon/components/status.js4
2 files changed, 20 insertions, 12 deletions
diff --git a/app/javascript/mastodon/components/attachment_list.js b/app/javascript/mastodon/components/attachment_list.js
index d8f90b5b6..8e5bb0e0b 100644
--- a/app/javascript/mastodon/components/attachment_list.js
+++ b/app/javascript/mastodon/components/attachment_list.js
@@ -19,11 +19,15 @@ export default class AttachmentList extends ImmutablePureComponent {
       return (
         <div className='attachment-list compact'>
           <ul className='attachment-list__list'>
-            {media.map(attachment => (
-              <li key={attachment.get('id')}>
-                <a href={attachment.get('remote_url')} target='_blank' rel='noopener'><i className='fa fa-link' /> {filename(attachment.get('remote_url'))}</a>
-              </li>
-            ))}
+            {media.map(attachment => {
+              const displayUrl = attachment.get('remote_url') || attachment.get('url');
+
+              return (
+                <li key={attachment.get('id')}>
+                  <a href={displayUrl} target='_blank' rel='noopener'><i className='fa fa-link' /> {filename(displayUrl)}</a>
+                </li>
+              );
+            })}
           </ul>
         </div>
       );
@@ -36,11 +40,15 @@ export default class AttachmentList extends ImmutablePureComponent {
         </div>
 
         <ul className='attachment-list__list'>
-          {media.map(attachment => (
-            <li key={attachment.get('id')}>
-              <a href={attachment.get('remote_url')} target='_blank' rel='noopener'>{filename(attachment.get('remote_url'))}</a>
-            </li>
-          ))}
+          {media.map(attachment => {
+            const displayUrl = attachment.get('remote_url') || attachment.get('url');
+
+            return (
+              <li key={attachment.get('id')}>
+                <a href={displayUrl} target='_blank' rel='noopener'>{filename(displayUrl)}</a>
+              </li>
+            );
+          })}
         </ul>
       </div>
     );
diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js
index c6f11c379..8102d1e06 100644
--- a/app/javascript/mastodon/components/status.js
+++ b/app/javascript/mastodon/components/status.js
@@ -178,8 +178,8 @@ export default class Status extends ImmutablePureComponent {
       status  = status.get('reblog');
     }
 
-    if (status.get('media_attachments').size > 0 && !this.props.muted) {
-      if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) {
+    if (status.get('media_attachments').size > 0) {
+      if (this.props.muted || status.get('media_attachments').some(item => item.get('type') === 'unknown')) {
         media = (
           <AttachmentList
             compact