From 3c44af11f7ba0d5270a52059c88e6e23f5c03892 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 21 Jul 2017 14:06:08 +0100 Subject: [PATCH] Revert changes to ChangeAvatar This component was basically adding nothing for group editing --- src/components/views/settings/ChangeAvatar.js | 45 ++++++------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/src/components/views/settings/ChangeAvatar.js b/src/components/views/settings/ChangeAvatar.js index 8c84f592be..ae6f1957b8 100644 --- a/src/components/views/settings/ChangeAvatar.js +++ b/src/components/views/settings/ChangeAvatar.js @@ -24,19 +24,11 @@ module.exports = React.createClass({ propTypes: { initialAvatarUrl: React.PropTypes.string, room: React.PropTypes.object, - - // if set, set initialAvatarUrl to the current avatar, if it has one - groupId: React.PropTypes.string, // if false, you need to call changeAvatar.onFileSelected yourself. showUploadSection: React.PropTypes.bool, width: React.PropTypes.number, height: React.PropTypes.number, - className: React.PropTypes.string, - - // Called with the mxc URL of the uploaded image after the avatar is - // uploaded. If undefined, the room or user avatar if changed once the - // image has finished uploading. Must be set for groups. - onUploadComplete: React.PropTypes.func, + className: React.PropTypes.string }, Phases: { @@ -80,19 +72,15 @@ module.exports = React.createClass({ var self = this; var httpPromise = MatrixClientPeg.get().uploadContent(file).then(function(url) { newUrl = url; - if (this.props.onAvatar) { - this.props.onAvatar(url); + if (self.props.room) { + return MatrixClientPeg.get().sendStateEvent( + self.props.room.roomId, + 'm.room.avatar', + {url: url}, + '' + ); } else { - if (self.props.room) { - return MatrixClientPeg.get().sendStateEvent( - self.props.room.roomId, - 'm.room.avatar', - {url: url}, - '' - ); - } else if (!this.props.groupId) { - return MatrixClientPeg.get().setAvatarUrl(url); - } + return MatrixClientPeg.get().setAvatarUrl(url); } }); @@ -123,25 +111,20 @@ module.exports = React.createClass({ }, render: function() { - let avatarImg; + var avatarImg; // Having just set an avatar we just display that since it will take a little // time to propagate through to the RoomAvatar. if (this.props.room && !this.avatarSet) { - const RoomAvatar = sdk.getComponent('avatars.RoomAvatar'); + var RoomAvatar = sdk.getComponent('avatars.RoomAvatar'); avatarImg = ; - } else if (this.props.groupId) { - const GroupAvatar = sdk.getComponent('avatars.GroupAvatar'); - avatarImg = ; } else { - const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); + var BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); // XXX: FIXME: once we track in the JS what our own displayname is(!) then use it here rather than ? avatarImg = ; } - let uploadSection; + var uploadSection; if (this.props.showUploadSection) { uploadSection = (
@@ -164,7 +147,7 @@ module.exports = React.createClass({
); case this.Phases.Uploading: - const Loader = sdk.getComponent("elements.Spinner"); + var Loader = sdk.getComponent("elements.Spinner"); return ( );