From 099d53d6f616ae9ec06417aeb0b3cdeccc26ca46 Mon Sep 17 00:00:00 2001 From: wangweiqiang Date: Mon, 14 Mar 2022 16:43:12 +0800 Subject: [PATCH 1/2] fix: partial error correction --- src/tinode.ts | 2 +- src/topic/topic-me.ts | 4 ++-- src/topic/topic.ts | 2 +- src/utilities.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tinode.ts b/src/tinode.ts index af3cc8d..73431a6 100644 --- a/src/tinode.ts +++ b/src/tinode.ts @@ -1335,7 +1335,7 @@ export class Tinode { */ isTopicOnline(topicName: string): boolean { const me = this.getMeTopic(); - const cont = me && me.getContact(name); + const cont = me && me.getContact(topicName); return cont && cont.online; } } diff --git a/src/topic/topic-me.ts b/src/topic/topic-me.ts index ae85800..402b27b 100644 --- a/src/topic/topic-me.ts +++ b/src/topic/topic-me.ts @@ -104,8 +104,8 @@ export class TopicMe extends Topic { if (!sub.noForwarding) { const topic = this.tinode.getTopic(topicName); if (topic) { - sub._noForwarding = true; - topic._processMetaDesc(sub); + sub.noForwarding = true; + topic.processMetaDesc(sub); } } } diff --git a/src/topic/topic.ts b/src/topic/topic.ts index a65b6d2..a55d028 100644 --- a/src/topic/topic.ts +++ b/src/topic/topic.ts @@ -152,7 +152,7 @@ export class Topic { // If topic name is explicitly provided, use it. If no name, then it's a new group topic, use "new". const ctrl = await this.tinode.subscribe(this.name || TopicNames.TOPIC_NEW, getParams, setParams); - if (ctrl.code >= 300) { + if (ctrl.code >= 400) { // Do nothing if the topic is already subscribed to. return ctrl; } diff --git a/src/utilities.ts b/src/utilities.ts index 748684e..91dff5f 100644 --- a/src/utilities.ts +++ b/src/utilities.ts @@ -185,7 +185,7 @@ export class Utilities { for (const prop in src) { if (src.hasOwnProperty(prop) && (!ignore || !ignore[prop]) && - (prop !== '_noForwarding')) { + (prop !== 'noForwarding')) { dst[prop] = Utilities.mergeObj(dst[prop], src[prop]); } From 32adeeca7430cef45e7c96639b808a0690713c0d Mon Sep 17 00:00:00 2001 From: wangweiqiang Date: Tue, 15 Mar 2022 13:56:03 +0800 Subject: [PATCH 2/2] fix: partial error correction --- src/cbuffer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cbuffer.ts b/src/cbuffer.ts index fcab7f7..120f560 100644 --- a/src/cbuffer.ts +++ b/src/cbuffer.ts @@ -92,7 +92,7 @@ export class CBuffer { startIdx = startIdx | 0; beforeIdx = beforeIdx || this.buffer.length; for (let i = startIdx; i < beforeIdx; i++) { - callback(context, this.buffer[i], i); + callback.call(context, this.buffer[i], i); } }