bug fix: incorrect handling of avatar pic in InfoView
This commit is contained in:
+14
-10
@@ -1327,6 +1327,13 @@
|
|||||||
dataUrl: this.props.avatar
|
dataUrl: this.props.avatar
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentWillReceiveProps: function(nextProps) {
|
||||||
|
if (this.props.avatar != nextProps.avatar) {
|
||||||
|
this.setState({dataUrl: nextProps.avatar});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
handleFileUpload(e) {
|
handleFileUpload(e) {
|
||||||
var instance = this;
|
var instance = this;
|
||||||
imageFileScaledToBase64(e.target.files[0], AVATAR_SIZE, AVATAR_SIZE, true,
|
imageFileScaledToBase64(e.target.files[0], AVATAR_SIZE, AVATAR_SIZE, true,
|
||||||
@@ -2635,17 +2642,13 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
|
||||||
this.initInfoView(this.props);
|
|
||||||
},
|
|
||||||
|
|
||||||
initInfoView: function(props) {
|
initInfoView: function(props) {
|
||||||
var topic = Tinode.getTopic(props.topic);
|
var topic = Tinode.getTopic(props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.previousMetaDesc != topic.onMetaDesc) {
|
if (this.onMetaDesc != topic.onMetaDesc) {
|
||||||
this.previousMetaDesc = topic.onMetaDesc;
|
this.previousMetaDesc = topic.onMetaDesc;
|
||||||
topic.onMetaDesc = this.onMetaDesc;
|
topic.onMetaDesc = this.onMetaDesc;
|
||||||
|
|
||||||
@@ -2671,6 +2674,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// No need to separately handle componentWillMount.
|
||||||
|
componentWillReceiveProps: function(nextProps) {
|
||||||
|
this.initInfoView(nextProps);
|
||||||
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
var topic = Tinode.getTopic(this.props.topic);
|
var topic = Tinode.getTopic(this.props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
@@ -2682,10 +2690,6 @@
|
|||||||
topic.onTagsUpdated = this.previousTagsUpdated;
|
topic.onTagsUpdated = this.previousTagsUpdated;
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
|
||||||
this.initInfoView(nextProps);
|
|
||||||
},
|
|
||||||
|
|
||||||
resetSubs: function(topic, props) {
|
resetSubs: function(topic, props) {
|
||||||
var newState = {contactList: []};
|
var newState = {contactList: []};
|
||||||
if (topic.getType() === "p2p") {
|
if (topic.getType() === "p2p") {
|
||||||
@@ -4467,7 +4471,7 @@
|
|||||||
} else {
|
} else {
|
||||||
// The message is a Drafty object.
|
// The message is a Drafty object.
|
||||||
var attachments = [];
|
var attachments = [];
|
||||||
dft.attachments(function(data) {
|
Drafty.attachments(dft, function(data) {
|
||||||
if (data.ref) {
|
if (data.ref) {
|
||||||
attachments.push(data.ref);
|
attachments.push(data.ref);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user