Sfoglia il codice sorgente

UserPicture use imageUrlCache

yusuketk 6 anni fa
parent
commit
6a3b853108
1 ha cambiato i file con 6 aggiunte e 23 eliminazioni
  1. 6 23
      src/client/js/components/User/UserPicture.jsx

+ 6 - 23
src/client/js/components/User/UserPicture.jsx

@@ -7,28 +7,6 @@ const DEFAULT_IMAGE = '/images/icons/user.svg';
 // TODO UserComponent?
 // TODO UserComponent?
 export default class UserPicture extends React.Component {
 export default class UserPicture extends React.Component {
 
 
-  getUserPicture(user) {
-    // gravatar
-    if (user.isGravatarEnabled === true) {
-      return this.generateGravatarSrc(user);
-    }
-    // uploaded image
-    if (user.image != null) {
-      return user.image;
-    }
-    if (user.imageAttachment != null) {
-      return user.imageAttachment.filePathProxied;
-    }
-
-    return DEFAULT_IMAGE;
-  }
-
-  generateGravatarSrc(user) {
-    const email = user.email || '';
-    const hash = md5(email.trim().toLowerCase());
-    return `https://gravatar.com/avatar/${hash}`;
-  }
-
   getClassName() {
   getClassName() {
     const className = ['img-circle', 'picture'];
     const className = ['img-circle', 'picture'];
     // size
     // size
@@ -56,9 +34,14 @@ export default class UserPicture extends React.Component {
       return this.renderForNull();
       return this.renderForNull();
     }
     }
 
 
+    if (!user.imageUrlCached) {
+      // [TODO][GW-1942] add imageUrlCached
+      return this.renderForNull();
+    }
+
     const imgElem = (
     const imgElem = (
       <img
       <img
-        src={this.getUserPicture(user)}
+        src={user.imageUrlCached}
         alt={user.username}
         alt={user.username}
         className={this.getClassName()}
         className={this.getClassName()}
       />
       />