|
|
@@ -9,6 +9,8 @@ import { apiv3Get, apiv3Put } from '../util/apiv3-client';
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
const logger = loggerFactory('growi:services:PersonalContainer');
|
|
|
|
|
|
+const DEFAULT_IMAGE = '/images/icons/user.svg';
|
|
|
+
|
|
|
/**
|
|
|
* Service container for personal settings page (PersonalSettings.jsx)
|
|
|
* @extends {Container} unstated Container
|
|
|
@@ -28,6 +30,8 @@ export default class PersonalContainer extends Container {
|
|
|
isEmailPublished: false,
|
|
|
lang: 'en_US',
|
|
|
isGravatarEnabled: false,
|
|
|
+ isUploadedPicture: false,
|
|
|
+ uploadedPictureSrc: this.getUploadedPictureSrc(this.appContainer.currentUser),
|
|
|
externalAccounts: [],
|
|
|
apiToken: '',
|
|
|
slackMemberId: '',
|
|
|
@@ -66,6 +70,25 @@ export default class PersonalContainer extends Container {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * define a function for uploaded picture
|
|
|
+ */
|
|
|
+ getUploadedPictureSrc(user) {
|
|
|
+ if (user == null) {
|
|
|
+ return DEFAULT_IMAGE;
|
|
|
+ }
|
|
|
+ if (user.image) {
|
|
|
+ this.setState({ isUploadedPicture: true });
|
|
|
+ return user.image;
|
|
|
+ }
|
|
|
+ if (user.imageAttachment != null) {
|
|
|
+ this.setState({ isUploadedPicture: true });
|
|
|
+ return user.imageAttachment.filePathProxied;
|
|
|
+ }
|
|
|
+
|
|
|
+ return DEFAULT_IMAGE;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* retrieve external accounts that linked me
|
|
|
*/
|