diff --git a/css/base.css b/css/base.css index 69c486cc..a3a3edad 100644 --- a/css/base.css +++ b/css/base.css @@ -922,14 +922,9 @@ table.permission-editor td.checkbox { background-image: url("../img/ignasi_pattern_s.png"); } -#messages-panel.write-only::after { - content: ""; - display: block; - position: absolute; - top:0; - right: 0; - bottom: 0; - left: 0; +#write-only-background { + height: 100%; + width: 100%; background-image: repeating-linear-gradient(45deg, transparent, transparent 0.5rem, rgba(255,255,255,.5) 0.5rem, rgba(255,255,255,.5) 1rem); } diff --git a/index.html b/index.html index 8b2ba9a4..4b5f4584 100644 --- a/index.html +++ b/index.html @@ -1855,24 +1855,24 @@ var ContactsView = React.createClass({ getInitialState: function() { return { - contactList: this.prepareContactList() + contactList: this.prepareContactList(), + initialLoadComplete: false }; }, componentWillMount: function() { var me = Tinode.getMeTopic(); - me.onContactUpdate = this.tnMeContactUpdate; - me.onSubsUpdated = this.tnMeSubsUpdated; - }, - componentWillUnmount: function() { - var me = Tinode.getMeTopic(); - me.onContactUpdate = undefined; - me.onSubsUpdated = undefined; + if (!me.onContactUpdate) { + me.onContactUpdate = this.tnMeContactUpdate; + me.onSubsUpdated = this.tnMeSubsUpdated; + } }, // Reactions to updates to the contact list. tnMeContactUpdate: function(what, cont) { - if (what === "on" || what === "off") { + console.log("presence", this.props.topicSelected, cont.topic, what); + if (what == "on" || what == "off") { this.resetContactList(); if (this.props.topicSelected === cont.topic) { + console.log("Online/offline", cont.topic, what); this.props.onOnlineChange(what === "on"); } } else if (what === "read") { @@ -1934,16 +1934,14 @@ }); updateFavicon(totalUnread > 0); - // Sort: most recent to less recent. - //contacts.sort(function(a, b) { - // return a.updated - b.updated; - //}); - return contacts; }, resetContactList: function() { - this.setState({contactList: this.prepareContactList()}); + if (!this.state.initialLoadComplete) { + console.log("update winodow.location.hash now!!!"); + } + this.setState({contactList: this.prepareContactList(), initialLoadComplete: true}); }, render: function() { @@ -3512,18 +3510,20 @@ : null} - -
-
    - {messageNodes} -
-
- {this.state.writeOnly ? -
no access to messages
+ onClearError={this.props.onError} /> : null} + +
+ {this.state.writeOnly ? +
+
no access to messages
+
+ : +
    + {messageNodes} +
+ } +
1) { var tp = Tinode.getTopicType(hash.path[1]); if (tp) { + console.log("setting topicSelected to", hash.path[1]); this.setState({topicSelected: hash.path[1]}); } else { + console.log("setting topicSelected to null"); this.setState({topicSelected: null}); } } @@ -3896,6 +3901,7 @@ if (Tinode.isAuthenticated()) { // Already logged in. Go to default screen. window.location.hash = ""; + return; } cred = cred ? Tinode.addCredential(null, cred) : undefined; @@ -3949,11 +3955,6 @@ // Logged in fine, subscribe to 'me' attaching callbacks from the contacts view. var me = Tinode.getMeTopic(); me.onMetaDesc = instance.tnMeMetaDesc; - if (!window.location.hash) { - window.location.hash = 'contacts'; - } else { - instance.handleHashRoute(); - } instance.setState({ connected: true, myUserId: Tinode.getCurrentUserID() @@ -3968,6 +3969,7 @@ ).catch(function(err){ instance.handleError(err.message, "err"); }); + window.location.hash = setUrlSidePanel(window.location.hash, 'contacts'); }, handleDisconnect: function(err) { @@ -4059,7 +4061,7 @@ }); } else { if (this.state.topicSelected) { - window.history.replaceState({}, "", setUrlTopic(window.location.hash, '')); + window.location.hash = setUrlTopic(window.location.hash, null); } // Currently selected contact deleted this.setState({ @@ -4178,6 +4180,7 @@ }, // Create of a new topic. New P2P topic requires peer's name. handleNewTopicRequest: function(peerName, pub, priv, tags) { + console.log("handleNewTopicRequest"); var instance = this; var topic = peerName ? Tinode.newTopicWith(peerName) : Tinode.newTopic(); var query = topic.startMetaQuery().withDesc().withSub().withData(); @@ -4187,7 +4190,9 @@ } topic.subscribe(query.build(), setParams).then(function() { - instance.handleTopicSelected(topic.name, undefined, false, topic.getAccessMode()); + console.log("subscribe successful", Tinode.isTopicOnline(topic.name)); + window.location.hash = setUrlSidePanel(window.location.hash, 'contacts'); + instance.handleTopicSelected(topic.name, undefined, Tinode.isTopicOnline(topic.name), topic.getAccessMode()); }).catch(function(err) { instance.handleError(err.message, "err"); });