don't send {not} for own messages; explicit defacs in p2p {sub}

This commit is contained in:
or-else
2019-02-28 13:56:35 +03:00
parent ff619da2b7
commit a042db27e8
6 changed files with 50 additions and 30 deletions
+3 -3
View File
@@ -356,9 +356,9 @@ class MessagesView extends React.Component {
newState.scrollPosition = 0;
}
// Aknowledge all messages, including own messages.
let status = topic.msgStatus(msg);
if (status >= Tinode.MESSAGE_STATUS_SENT) {
// Aknowledge messages except own messages.
const status = topic.msgStatus(msg);
if (status >= Tinode.MESSAGE_STATUS_SENT && msg.from != this.props.myUserId) {
this.props.readTimerHandler(() => {
topic.noteRead(msg.seq);
});
+7 -4
View File
@@ -609,7 +609,7 @@ class TinodeWeb extends React.Component {
// Sending "received" notifications
tnData(data) {
const topic = this.tinode.getTopic(data.topic);
if (topic.msgStatus(data) >= Tinode.MESSAGE_STATUS_SENT) {
if (topic.msgStatus(data) >= Tinode.MESSAGE_STATUS_SENT && data.from != this.state.myUserId) {
clearTimeout(this.receivedTimer);
this.receivedTimer = setTimeout(() => {
this.receivedTimer = undefined;
@@ -690,7 +690,6 @@ class TinodeWeb extends React.Component {
showInfoPanel: false
});
console.log("handleTopicSelected: null navigation");
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', null));
}
}
@@ -948,9 +947,13 @@ class TinodeWeb extends React.Component {
const topicName = peerName || this.tinode.newGroupTopicName();
const params = {
_topicName: topicName,
sub: {mode: DEFAULT_ACCESS_MODE}
};
if (!peerName) {
if (peerName) {
// Because we are initialing the subscription, set 'want' to all permissions.
params.sub = {mode: DEFAULT_ACCESS_MODE};
// Give the other user all permissions too.
params.desc = {defacs: {auth: DEFAULT_ACCESS_MODE}};
} else {
params.desc = {public: pub, private: {comment: priv}};
params.tags = tags;
}