bug fixes in InfoView
This commit is contained in:
+14
-27
@@ -2395,8 +2395,6 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
initInfoView: function(props) {
|
initInfoView: function(props) {
|
||||||
console.log("InfoView.initInfoView");
|
|
||||||
|
|
||||||
var topic = Tinode.getTopic(props.topic);
|
var topic = Tinode.getTopic(props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
@@ -2419,8 +2417,6 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
resetInfoView: function(topic, props, forced) {
|
resetInfoView: function(topic, props, forced) {
|
||||||
console.log("InfoView.resetInfoView");
|
|
||||||
|
|
||||||
if (forced || this.props.topic != props.topic) {
|
if (forced || this.props.topic != props.topic) {
|
||||||
this.resetDesc(topic, props);
|
this.resetDesc(topic, props);
|
||||||
this.resetSubs(topic, props);
|
this.resetSubs(topic, props);
|
||||||
@@ -2442,7 +2438,6 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(props) {
|
componentWillReceiveProps: function(props) {
|
||||||
console.log("InfoView.componentWillReceiveProps");
|
|
||||||
var topic = Tinode.getTopic(props.topic);
|
var topic = Tinode.getTopic(props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
@@ -2451,46 +2446,45 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
resetSubs: function(topic, props) {
|
resetSubs: function(topic, props) {
|
||||||
console.log("InfoView.resetSubs");
|
|
||||||
var newState = {contactList: []};
|
var newState = {contactList: []};
|
||||||
if (topic.getType() === "p2p") {
|
if (topic.getType() === "p2p") {
|
||||||
// Fetch the other party in the p2p conversation.
|
// Fetch the other party in the p2p conversation.
|
||||||
var user2 = topic.subscriber(props.topic);
|
var user2 = topic.subscriber(props.topic);
|
||||||
newState.modeGiven2 = user2.acs.getGiven();
|
newState.modeGiven2 = user2.acs.getGiven();
|
||||||
newState.modeWant2 = user2.acs.getWant();
|
newState.modeWant2 = user2.acs.getWant();
|
||||||
|
} else {
|
||||||
|
topic.subscribers(function(sub){
|
||||||
|
console.log(sub);
|
||||||
|
newState.contactList.push(sub);
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
topic.subscribers(function(sub){
|
|
||||||
newState.contactList.push(sub);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetDesc: function(topic, props) {
|
resetDesc: function(topic, props) {
|
||||||
console.log("InfoView.resetDesc");
|
|
||||||
|
|
||||||
var defacs = topic.getDefaultAccess() || {};
|
var defacs = topic.getDefaultAccess() || {};
|
||||||
|
var acs = topic.getAccessMode();
|
||||||
this.setState({
|
this.setState({
|
||||||
owner: props.acs.isOwner(),
|
owner: acs && acs.isOwner(),
|
||||||
admin: props.acs.isAdmin(),
|
admin: acs && acs.isAdmin(),
|
||||||
sharer: (props.acs.isAdmin() || props.acs.isSharer()),
|
sharer: acs && (acs.isAdmin() || acs.isSharer()),
|
||||||
muted: props.acs.isMuted(),
|
muted: acs && acs.isMuted(),
|
||||||
|
|
||||||
fullName: topic.public ? topic.public.fn : undefined,
|
fullName: topic.public ? topic.public.fn : undefined,
|
||||||
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
|
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
|
||||||
private: topic.private,
|
private: topic.private,
|
||||||
address: topic.name,
|
address: topic.name,
|
||||||
groupTopic: (topic.getType() === "grp"),
|
groupTopic: (topic.getType() === "grp"),
|
||||||
access: props.acs.getMode(),
|
access: acs ? acs.getMode() : undefined,
|
||||||
modeGiven: props.acs.getGiven(),
|
modeGiven: acs ? acs.getGiven() : undefined,
|
||||||
modeWant: props.acs.getWant(),
|
modeWant: acs ? acs.getWant() : undefined,
|
||||||
auth: defacs.auth,
|
auth: defacs.auth,
|
||||||
anon: defacs.anon
|
anon: defacs.anon
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onMetaDesc: function(desc) {
|
onMetaDesc: function(desc) {
|
||||||
console.log("InfoView.onMetaDesc")
|
|
||||||
var topic = Tinode.getTopic(this.props.topic);
|
var topic = Tinode.getTopic(this.props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
@@ -2498,13 +2492,11 @@
|
|||||||
this.resetDesc(topic, this.props);
|
this.resetDesc(topic, this.props);
|
||||||
|
|
||||||
if (this.previousMetaDesc && this.previousMetaDesc != this.onMetaDesc) {
|
if (this.previousMetaDesc && this.previousMetaDesc != this.onMetaDesc) {
|
||||||
console.log("InfoView.previousMetaDesc");
|
|
||||||
this.previousMetaDesc(desc);
|
this.previousMetaDesc(desc);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onSubsUpdated: function() {
|
onSubsUpdated: function() {
|
||||||
console.log("InfoView.onSubsUpdated");
|
|
||||||
var topic = Tinode.getTopic(this.props.topic);
|
var topic = Tinode.getTopic(this.props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
@@ -2512,17 +2504,14 @@
|
|||||||
this.resetSubs(topic, this.props);
|
this.resetSubs(topic, this.props);
|
||||||
|
|
||||||
if (this.previousSubsUpdated && this.previousSubsUpdated != this.onSubsUpdated) {
|
if (this.previousSubsUpdated && this.previousSubsUpdated != this.onSubsUpdated) {
|
||||||
console.log("InfoView.previousSubsUpdated");
|
|
||||||
this.previousSubsUpdated();
|
this.previousSubsUpdated();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onTagsUpdated: function(tags) {
|
onTagsUpdated: function(tags) {
|
||||||
console.log("InfoView.onTagsUpdated");
|
|
||||||
this.setState({tags: tags});
|
this.setState({tags: tags});
|
||||||
|
|
||||||
if (this.previousTagsUpdated && this.previousTagsUpdated != this.onTagsUpdated) {
|
if (this.previousTagsUpdated && this.previousTagsUpdated != this.onTagsUpdated) {
|
||||||
console.log("InfoView.previousTagsUpdated");
|
|
||||||
this.previousTagsUpdated();
|
this.previousTagsUpdated();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3275,7 +3264,7 @@
|
|||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("other change in topic: " + info.what);
|
console.log("Other change in topic: " + info.what);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -3917,7 +3906,6 @@
|
|||||||
},
|
},
|
||||||
// Permissions of a currently selected topic have been updated by server.
|
// Permissions of a currently selected topic have been updated by server.
|
||||||
handleTopicSelectedAcs: function(acs) {
|
handleTopicSelectedAcs: function(acs) {
|
||||||
console.log("update acs in MessagesView", acs);
|
|
||||||
this.setState({topicSelectedAcs: acs});
|
this.setState({topicSelectedAcs: acs});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -4261,7 +4249,6 @@
|
|||||||
displayMobile={this.state.displayMobile}
|
displayMobile={this.state.displayMobile}
|
||||||
topic={this.state.topicSelected}
|
topic={this.state.topicSelected}
|
||||||
foundContacts={this.state.foundContacts}
|
foundContacts={this.state.foundContacts}
|
||||||
acs={this.state.topicSelectedAcs}
|
|
||||||
myUserId={this.state.myUserId}
|
myUserId={this.state.myUserId}
|
||||||
errorText={this.state.errorText}
|
errorText={this.state.errorText}
|
||||||
errorLevel={this.state.errorLevel}
|
errorLevel={this.state.errorLevel}
|
||||||
|
|||||||
Reference in New Issue
Block a user