Revert changes to ChangeAvatar
This component was basically adding nothing for group editingpull/21833/head
parent
f2afd852d8
commit
3c44af11f7
|
@ -24,19 +24,11 @@ module.exports = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
initialAvatarUrl: React.PropTypes.string,
|
initialAvatarUrl: React.PropTypes.string,
|
||||||
room: React.PropTypes.object,
|
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.
|
// if false, you need to call changeAvatar.onFileSelected yourself.
|
||||||
showUploadSection: React.PropTypes.bool,
|
showUploadSection: React.PropTypes.bool,
|
||||||
width: React.PropTypes.number,
|
width: React.PropTypes.number,
|
||||||
height: React.PropTypes.number,
|
height: React.PropTypes.number,
|
||||||
className: React.PropTypes.string,
|
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,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Phases: {
|
Phases: {
|
||||||
|
@ -80,19 +72,15 @@ module.exports = React.createClass({
|
||||||
var self = this;
|
var self = this;
|
||||||
var httpPromise = MatrixClientPeg.get().uploadContent(file).then(function(url) {
|
var httpPromise = MatrixClientPeg.get().uploadContent(file).then(function(url) {
|
||||||
newUrl = url;
|
newUrl = url;
|
||||||
if (this.props.onAvatar) {
|
if (self.props.room) {
|
||||||
this.props.onAvatar(url);
|
return MatrixClientPeg.get().sendStateEvent(
|
||||||
|
self.props.room.roomId,
|
||||||
|
'm.room.avatar',
|
||||||
|
{url: url},
|
||||||
|
''
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if (self.props.room) {
|
return MatrixClientPeg.get().setAvatarUrl(url);
|
||||||
return MatrixClientPeg.get().sendStateEvent(
|
|
||||||
self.props.room.roomId,
|
|
||||||
'm.room.avatar',
|
|
||||||
{url: url},
|
|
||||||
''
|
|
||||||
);
|
|
||||||
} else if (!this.props.groupId) {
|
|
||||||
return MatrixClientPeg.get().setAvatarUrl(url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -123,25 +111,20 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
let avatarImg;
|
var avatarImg;
|
||||||
// Having just set an avatar we just display that since it will take a little
|
// Having just set an avatar we just display that since it will take a little
|
||||||
// time to propagate through to the RoomAvatar.
|
// time to propagate through to the RoomAvatar.
|
||||||
if (this.props.room && !this.avatarSet) {
|
if (this.props.room && !this.avatarSet) {
|
||||||
const RoomAvatar = sdk.getComponent('avatars.RoomAvatar');
|
var RoomAvatar = sdk.getComponent('avatars.RoomAvatar');
|
||||||
avatarImg = <RoomAvatar room={this.props.room} width={ this.props.width } height={ this.props.height } resizeMethod='crop' />;
|
avatarImg = <RoomAvatar room={this.props.room} width={ this.props.width } height={ this.props.height } resizeMethod='crop' />;
|
||||||
} else if (this.props.groupId) {
|
|
||||||
const GroupAvatar = sdk.getComponent('avatars.GroupAvatar');
|
|
||||||
avatarImg = <GroupAvatar groupId={this.props.groupId} groupAvatarUrl={this.props.initialAvatarUrl}
|
|
||||||
width={this.props.width} height={this.props.height} resizeMethod='crop'
|
|
||||||
/>;
|
|
||||||
} else {
|
} 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 ?
|
// XXX: FIXME: once we track in the JS what our own displayname is(!) then use it here rather than ?
|
||||||
avatarImg = <BaseAvatar width={this.props.width} height={this.props.height} resizeMethod='crop'
|
avatarImg = <BaseAvatar width={this.props.width} height={this.props.height} resizeMethod='crop'
|
||||||
name='?' idName={ MatrixClientPeg.get().getUserIdLocalpart() } url={this.state.avatarUrl} />;
|
name='?' idName={ MatrixClientPeg.get().getUserIdLocalpart() } url={this.state.avatarUrl} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
let uploadSection;
|
var uploadSection;
|
||||||
if (this.props.showUploadSection) {
|
if (this.props.showUploadSection) {
|
||||||
uploadSection = (
|
uploadSection = (
|
||||||
<div className={this.props.className}>
|
<div className={this.props.className}>
|
||||||
|
@ -164,7 +147,7 @@ module.exports = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case this.Phases.Uploading:
|
case this.Phases.Uploading:
|
||||||
const Loader = sdk.getComponent("elements.Spinner");
|
var Loader = sdk.getComponent("elements.Spinner");
|
||||||
return (
|
return (
|
||||||
<Loader />
|
<Loader />
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue