about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/avatar.js
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-08-07 19:44:55 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-08-07 19:44:55 +0200
commit594234740788a51fa528152343eb50dc1c6ca093 (patch)
tree07a8e94ab9405f54694117b04637b2db64ef3f52 /app/javascript/mastodon/components/avatar.js
parent22db9472253f6ffcfed254f7a406a58b53e80cfe (diff)
Refactor Avatar and AvatarOverlay to have 'account' as prop instead of src and staticSrc (#4526)
* Refactored Avatar and AvatarOverlay (DRY) to have 'account' as prop.
Also removed animate attribute from compose navigation bar, which should
have never been there. Added test for avatar overlay.

* fix broken tests

* god dammit another bug in tests! travis please let this pass

* formatting in avatar overlay
Diffstat (limited to 'app/javascript/mastodon/components/avatar.js')
-rw-r--r--app/javascript/mastodon/components/avatar.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/javascript/mastodon/components/avatar.js b/app/javascript/mastodon/components/avatar.js
index 4f8170657..f7c484ee3 100644
--- a/app/javascript/mastodon/components/avatar.js
+++ b/app/javascript/mastodon/components/avatar.js
@@ -1,11 +1,11 @@
 import React from 'react';
 import PropTypes from 'prop-types';
+import ImmutablePropTypes from 'react-immutable-proptypes';
 
 export default class Avatar extends React.PureComponent {
 
   static propTypes = {
-    src: PropTypes.string.isRequired,
-    staticSrc: PropTypes.string,
+    account: ImmutablePropTypes.map.isRequired,
     size: PropTypes.number.isRequired,
     style: PropTypes.object,
     animate: PropTypes.bool,
@@ -33,9 +33,12 @@ export default class Avatar extends React.PureComponent {
   }
 
   render () {
-    const { src, size, staticSrc, animate, inline } = this.props;
+    const { account, size, animate, inline } = this.props;
     const { hovering } = this.state;
 
+    const src = account.get('avatar');
+    const staticSrc = account.get('avatar_static');
+
     let className = 'account__avatar';
 
     if (inline) {