about summary refs log tree commit diff
path: root/app/javascript/mastodon/selectors
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-05-20 01:28:25 +0200
committerGitHub <noreply@github.com>2017-05-20 01:28:25 +0200
commitde475cf8d32744330f8029f13c539237a6567029 (patch)
treeeaad397dac2ea78230500fd3a7e150021b960d57 /app/javascript/mastodon/selectors
parentb369fc2de4ab0242775a56fb6208d9dbf2109d91 (diff)
Add account media gallery view to web UI (#3120)
* Add account media gallery view to web UI

* Link media view from account dropdown

* Adjust link
Diffstat (limited to 'app/javascript/mastodon/selectors')
-rw-r--r--app/javascript/mastodon/selectors/index.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/mastodon/selectors/index.js
index c2a8fd4cf..f1697cc2d 100644
--- a/app/javascript/mastodon/selectors/index.js
+++ b/app/javascript/mastodon/selectors/index.js
@@ -74,3 +74,17 @@ export const makeGetNotification = () => {
     return base.set('account', account);
   });
 };
+
+export const getAccountGallery = createSelector([
+  (state, id) => state.getIn(['timelines', 'accounts_media_timelines', id, 'items'], Immutable.List()),
+  state       => state.get('statuses'),
+], (statusIds, statuses) => {
+  let medias = Immutable.List();
+
+  statusIds.forEach(statusId => {
+    const status = statuses.get(statusId);
+    medias = medias.concat(status.get('media_attachments').map(media => media.set('status', status)));
+  });
+
+  return medias;
+});