Profile picture setting and notifdications thereof.
This commit is contained in:
parent
782234de6d
commit
ff567faeaa
3 changed files with 44 additions and 2 deletions
|
@ -46,7 +46,28 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
uploadNewAvatar: function() {
|
||||
setAvatarFromFile: function(file) {
|
||||
var newUrl = null;
|
||||
|
||||
this.setState({
|
||||
phase: this.Phases.Uploading
|
||||
});
|
||||
var self = this;
|
||||
MatrixClientPeg.get().uploadContent(file).then(function(url) {
|
||||
newUrl = url;
|
||||
return MatrixClientPeg.get().setProfileInfo('avatar_url', {
|
||||
avatar_url: url
|
||||
});
|
||||
}).done(function() {
|
||||
self.setState({
|
||||
phase: self.Phases.Display,
|
||||
avatarUrl: MatrixClientPeg.get().mxcUrlToHttp(newUrl)
|
||||
});
|
||||
}, function(error) {
|
||||
self.setState({
|
||||
phase: this.Phases.Error
|
||||
});
|
||||
self.onError(error);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue