diff --git a/index.html b/index.html index f3ffa6a9..26bcfb76 100644 --- a/index.html +++ b/index.html @@ -1654,6 +1654,8 @@ access: null, modeGiven: null, modeWant: null, + modeGiven2: null, // P2P topic, the other user mode given + modeWant2: null, // P2P topic, the other user mode want auth: null, anon: null, contactList: [], @@ -1689,12 +1691,23 @@ resetSubs: function(topic) { var contacts = []; - topic.subscribers(function(sub){ - contacts.push(sub); - }, this); - this.setState({ - contactList: contacts - }); + if (topic.getType() === "p2p") { + // Fetch the other party in the p2p conversation. + var user2 = topic.subscriber(this.props.topic); + this.setState({ + modeGiven2: user2.acs.getGiven(), + modeWant2: user2.acs.getWant(), + }); + console.log("Processed resetSub"); + console.log(user2); + } else { + topic.subscribers(function(sub){ + contacts.push(sub); + }, this); + this.setState({ + contactList: contacts + }); + } }, resetDesc: function(topic) { @@ -1727,6 +1740,7 @@ }, onSubsUpdated: function() { + console.log("onSubsUpdated"); var topic = Tinode.getTopic(this.props.topic); if (!topic) { return; @@ -1764,7 +1778,7 @@ this.props.onChangePermissions(this.props.topic, checked ? "-P" : "+P"); }, - handlePermissionsChanged: function(perm, uid) { + handlePermissionsChanged: function(perm) { switch (this.state.showPermissionEditorFor) { case 'auth': this.props.onTopicDescUpdate(this.props.topic, null, null, {auth: perm}); @@ -1777,7 +1791,7 @@ this.props.onChangePermissions(this.props.topic, perm); break; case 'given': - this.props.onChangePermissions(this.props.topic, perm, uid); + this.props.onChangePermissions(this.props.topic, perm, this.props.topic); break; } @@ -1798,8 +1812,8 @@ titleCompare = 'Granted'; break; case 'given': - toEdit = this.state.modeGiven; - toCompare = this.state.modeWant; + toEdit = this.state.modeGiven2; + toCompare = this.state.modeWant2; titleEdit = 'Granted'; titleCompare = 'Requested'; break; @@ -1913,18 +1927,34 @@ {this.state.address} -