forked from matrix/element-web
Tidy up profile picture setting & fix notification bug
This commit is contained in:
parent
88167358bb
commit
214ef4b4ce
|
@ -33,7 +33,7 @@ module.exports = React.createClass({
|
|||
|
||||
onError: function(error) {
|
||||
this.setState({
|
||||
errorText: "Failed to set profile picture!"
|
||||
errorText: "Failed to upload profile picture!"
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ function textForMemberEvent(ev) {
|
|||
return senderName + " banned " + targetName + "." + reason;
|
||||
case 'join':
|
||||
if (ev.getPrevContent() && ev.getPrevContent().membership == 'join') {
|
||||
if (ev.getPrevContent().displayname && ev.getContent().displayname) {
|
||||
if (ev.getPrevContent().displayname && ev.getContent().displayname && ev.getPrevContent().displayname != ev.getContent().displayname) {
|
||||
return ev.getSender() + " changed their display name from " +
|
||||
ev.getPrevContent().displayname + " to " +
|
||||
ev.getContent().displayname;
|
||||
|
@ -23,7 +23,7 @@ function textForMemberEvent(ev) {
|
|||
return ev.getSender() + " removed their display name";
|
||||
} else if (ev.getPrevContent().avatar_url && !ev.getContent().avatar_url) {
|
||||
return ev.getSender() + " removed their profile picture";
|
||||
} else if (ev.getPrevContent().avatar_url && ev.getContent().avatar_url) {
|
||||
} else if (ev.getPrevContent().avatar_url && ev.getContent().avatar_url && ev.getPrevContent().avatar_url != ev.getContent().avatar_url) {
|
||||
return ev.getSender() + " changed their profile picture";
|
||||
} else if (!ev.getPrevContent().avatar_url && ev.getContent().avatar_url) {
|
||||
return ev.getSender() + " set a profile picture";
|
||||
|
|
|
@ -55,9 +55,7 @@ module.exports = {
|
|||
var self = this;
|
||||
MatrixClientPeg.get().uploadContent(file).then(function(url) {
|
||||
newUrl = url;
|
||||
return MatrixClientPeg.get().setProfileInfo('avatar_url', {
|
||||
avatar_url: url
|
||||
});
|
||||
return MatrixClientPeg.get().setAvatarUrl(url);
|
||||
}).done(function() {
|
||||
self.setState({
|
||||
phase: self.Phases.Display,
|
||||
|
|
|
@ -50,16 +50,6 @@ module.exports = {
|
|||
);
|
||||
},
|
||||
|
||||
changeAvatarUrl: function(new_avatar_url) {
|
||||
if (this.state.avatarUrl == new_avatar_url) return;
|
||||
|
||||
var self = this;
|
||||
return MatrixClientPeg.get().setAvatarUrl(new_avatar_url).then(
|
||||
function() { self.setState({displayName: new_displayname}); },
|
||||
function(err) { console.err(err); }
|
||||
);
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
var self = this;
|
||||
var cli = MatrixClientPeg.get();
|
||||
|
|
Loading…
Reference in New Issue