yet even more bug fixes in navigation
This commit is contained in:
+38
-30
@@ -652,11 +652,11 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
// If text has changed while in read mode, update text and discard changes.
|
// If text has changed while in read mode, update text and discard changes.
|
||||||
// Ignore update if in edit mode.
|
// Ignore update if in edit mode.
|
||||||
if (this.props.text != newProps.text && !this.state.active) {
|
if (this.props.text != nextProps.text && !this.state.active) {
|
||||||
this.setState({text: newProps.text || ""});
|
this.setState({text: nextProps.text || ""});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -904,12 +904,12 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
this.setState({
|
this.setState({
|
||||||
sortedChips: this.sortChips(newProps.chips, newProps.required),
|
sortedChips: this.sortChips(nextProps.chips, nextProps.required),
|
||||||
chipIndex: this.indexChips(newProps.chips)
|
chipIndex: this.indexChips(nextProps.chips)
|
||||||
});
|
});
|
||||||
if (newProps.chips.length > this.props.chips.length) {
|
if (nextProps.chips.length > this.props.chips.length) {
|
||||||
// Chip added: clear input.
|
// Chip added: clear input.
|
||||||
this.setState({input: ''});
|
this.setState({input: ''});
|
||||||
}
|
}
|
||||||
@@ -1485,8 +1485,8 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
this.setState({show: !(!newProps.level)});
|
this.setState({show: !(!nextProps.level)});
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
@@ -1855,8 +1855,7 @@
|
|||||||
var ContactsView = React.createClass({
|
var ContactsView = React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
contactList: this.prepareContactList(),
|
contactList: this.prepareContactList()
|
||||||
initialLoadComplete: false
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
@@ -1866,13 +1865,27 @@
|
|||||||
me.onSubsUpdated = this.tnMeSubsUpdated;
|
me.onSubsUpdated = this.tnMeSubsUpdated;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentWillReceiveProps: function(nextProps) {
|
||||||
|
if (this.props.topicSelected != nextProps.topicSelected) {
|
||||||
|
// If topicSelecetd is changed externally, update the
|
||||||
|
// topic with online status and access mode.
|
||||||
|
for (var i=0;i<this.state.contactList.length;i++) {
|
||||||
|
var c = this.state.contactList[i];
|
||||||
|
if (c.topic == nextProps.topicSelected) {
|
||||||
|
nextProps.onOnlineChange(c.online);
|
||||||
|
nextProps.onAcsChange(c.acs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Reactions to updates to the contact list.
|
// Reactions to updates to the contact list.
|
||||||
tnMeContactUpdate: function(what, cont) {
|
tnMeContactUpdate: function(what, cont) {
|
||||||
console.log("presence", this.props.topicSelected, cont.topic, what);
|
|
||||||
if (what == "on" || what == "off") {
|
if (what == "on" || what == "off") {
|
||||||
this.resetContactList();
|
this.resetContactList();
|
||||||
if (this.props.topicSelected === cont.topic) {
|
if (this.props.topicSelected == cont.topic) {
|
||||||
console.log("Online/offline", cont.topic, what);
|
|
||||||
this.props.onOnlineChange(what === "on");
|
this.props.onOnlineChange(what === "on");
|
||||||
}
|
}
|
||||||
} else if (what === "read") {
|
} else if (what === "read") {
|
||||||
@@ -1907,10 +1920,10 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO(gene): handle other types of notifications:
|
// TODO(gene): handle other types of notifications:
|
||||||
// * ua -- user agent changes (may display a pictogram for mobile/desktop)
|
// * ua -- user agent changes (maybe display a pictogram for mobile/desktop).
|
||||||
// * upd -- topic 'public' updated
|
// * upd -- topic 'public' updated, issue getMeta().
|
||||||
// * del -- messages deleted (hard or soft) -- reset pill counter
|
// * del -- messages deleted (hard or soft) -- reset pill counter.
|
||||||
console.log("changed (not updating for it): " + what + " in: " + cont.topic);
|
console.log("Unsupported (yet) presence update:" + what + " in: " + cont.topic);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1943,10 +1956,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
resetContactList: function() {
|
resetContactList: function() {
|
||||||
if (!this.state.initialLoadComplete) {
|
this.setState({contactList: this.prepareContactList()});
|
||||||
console.log("update winodow.location.hash now!!!");
|
|
||||||
}
|
|
||||||
this.setState({contactList: this.prepareContactList(), initialLoadComplete: true});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
@@ -2544,12 +2554,12 @@
|
|||||||
topic.onTagsUpdated = this.previousTagsUpdated;
|
topic.onTagsUpdated = this.previousTagsUpdated;
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(props) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
var topic = Tinode.getTopic(props.topic);
|
var topic = Tinode.getTopic(nextProps.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.resetInfoView(topic, props);
|
this.resetInfoView(topic, nextProps);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetSubs: function(topic, props) {
|
resetSubs: function(topic, props) {
|
||||||
@@ -3848,14 +3858,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Topic for MessagesView selector.
|
// Topic for MessagesView selector.
|
||||||
console.log("hashchange", window.location.hash, hash.path);
|
|
||||||
if (hash.path.length > 1) {
|
if (hash.path.length > 1) {
|
||||||
var tp = Tinode.getTopicType(hash.path[1]);
|
var tp = Tinode.getTopicType(hash.path[1]);
|
||||||
if (tp) {
|
if (tp) {
|
||||||
console.log("setting topicSelected to", hash.path[1]);
|
|
||||||
this.setState({topicSelected: hash.path[1]});
|
this.setState({topicSelected: hash.path[1]});
|
||||||
} else {
|
} else {
|
||||||
console.log("setting topicSelected to null");
|
|
||||||
this.setState({topicSelected: null});
|
this.setState({topicSelected: null});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4087,7 +4094,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleTopicSelectedOnline: function(online) {
|
handleTopicSelectedOnline: function(online) {
|
||||||
this.setState({topicSelectedOnline: online});
|
if (typeof online == 'boolean') {
|
||||||
|
this.setState({topicSelectedOnline: online});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 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) {
|
||||||
@@ -4191,7 +4200,6 @@
|
|||||||
},
|
},
|
||||||
// Create of a new topic. New P2P topic requires peer's name.
|
// Create of a new topic. New P2P topic requires peer's name.
|
||||||
handleNewTopicRequest: function(peerName, pub, priv, tags) {
|
handleNewTopicRequest: function(peerName, pub, priv, tags) {
|
||||||
console.log("handleNewTopicRequest");
|
|
||||||
var instance = this;
|
var instance = this;
|
||||||
var topic = peerName ? Tinode.newTopicWith(peerName) : Tinode.newTopic();
|
var topic = peerName ? Tinode.newTopicWith(peerName) : Tinode.newTopic();
|
||||||
var query = topic.startMetaQuery().withDesc().withSub().withData();
|
var query = topic.startMetaQuery().withDesc().withSub().withData();
|
||||||
|
|||||||
Reference in New Issue
Block a user