@droppii-org/chat-sdk 0.4.14 → 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAQ3C,QAAA,MAAM,oBAAoB,gFA+XvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { DChatSDK } from "../constants/sdk";
|
|
|
4
4
|
import { conversationSort, isGroupConversation } from "../utils/imCommon";
|
|
5
5
|
import { PeerType } from "../types/conversation";
|
|
6
6
|
import useUserStore from "./user";
|
|
7
|
+
import useAuthStore from "./auth";
|
|
7
8
|
const CONVERSATION_SPLIT_COUNT = 500;
|
|
8
9
|
const useConversationStore = create((set, get) => ({
|
|
9
10
|
conversationData: null,
|
|
@@ -85,7 +86,7 @@ const useConversationStore = create((set, get) => ({
|
|
|
85
86
|
}));
|
|
86
87
|
},
|
|
87
88
|
updateCurrentConversation: async (conversation, options) => {
|
|
88
|
-
var _a
|
|
89
|
+
var _a;
|
|
89
90
|
if (!conversation) {
|
|
90
91
|
set({
|
|
91
92
|
currentConversation: undefined,
|
|
@@ -130,22 +131,27 @@ const useConversationStore = create((set, get) => ({
|
|
|
130
131
|
get().getCurrentMemberInGroupByReq(groupID),
|
|
131
132
|
]);
|
|
132
133
|
}
|
|
133
|
-
// Fresh page load
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
134
|
+
// Fresh page load / external entry (search, notification) skips
|
|
135
|
+
// leftGroupHandler's WS-driven detection — derive the same
|
|
136
|
+
// public->view-only / private->block state from the fetch/cache
|
|
137
|
+
// above. Compare against `conversation.groupID` (the argument, not
|
|
138
|
+
// global state) — conversationData can be clobbered by a concurrent
|
|
139
|
+
// setConversationData call before this async function resumes past
|
|
140
|
+
// its first await, which previously made this check unreliable.
|
|
137
141
|
// Require confirmed peerType — a CX/bot session can ride a Group
|
|
138
142
|
// session with peerType missing from a raw fetch; don't block on that.
|
|
139
143
|
const isConfirmedGroup = conversation.peerType === PeerType.GROUP;
|
|
140
|
-
const stillOpen = ((_a = get().conversationData) === null || _a === void 0 ? void 0 : _a.groupID) === groupID;
|
|
141
144
|
const notAMember = !get().currentMemberInGroup.has(groupID);
|
|
142
|
-
const isPublic = ((
|
|
143
|
-
if (isConfirmedGroup &&
|
|
145
|
+
const isPublic = ((_a = get().currentGroupInfo.get(groupID)) === null || _a === void 0 ? void 0 : _a.visibility) === GroupVisibility.Public;
|
|
146
|
+
if (isConfirmedGroup && notAMember && isPublic) {
|
|
144
147
|
set({ isViewOnlyMember: true });
|
|
145
148
|
}
|
|
146
|
-
else if (isConfirmedGroup &&
|
|
149
|
+
else if (isConfirmedGroup && notAMember) {
|
|
150
|
+
// Blocked: don't fall through to setting currentConversation below
|
|
151
|
+
// — that would re-open the very conversation just cleared.
|
|
147
152
|
get().clearSelectedConversation();
|
|
148
153
|
get().showRemovedFromGroupModal();
|
|
154
|
+
return;
|
|
149
155
|
}
|
|
150
156
|
}
|
|
151
157
|
// Non-group conversations never carry group Map state — nothing to
|
|
@@ -188,7 +194,10 @@ const useConversationStore = create((set, get) => ({
|
|
|
188
194
|
},
|
|
189
195
|
getCurrentMemberInGroupByReq: async (groupID) => {
|
|
190
196
|
let memberInfo;
|
|
191
|
-
const selfID = useUserStore.getState().selfInfo.id;
|
|
197
|
+
const selfID = useAuthStore.getState().userID || useUserStore.getState().selfInfo.id;
|
|
198
|
+
if (!selfID) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
192
201
|
try {
|
|
193
202
|
const { data } = await DChatSDK.getSpecifiedGroupMembersInfo({
|
|
194
203
|
groupID,
|