@droppii-org/chat-sdk 0.3.4 → 0.3.5
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":"GroupThreadInfo.d.ts","sourceRoot":"","sources":["../../../src/components/thread/GroupThreadInfo.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,qBAAqB;IACpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,UAAU,oBAAoB;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAID,QAAA,MAAM,eAAe,GAAI,qBAAqB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"GroupThreadInfo.d.ts","sourceRoot":"","sources":["../../../src/components/thread/GroupThreadInfo.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,qBAAqB;IACpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,UAAU,oBAAoB;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAID,QAAA,MAAM,eAAe,GAAI,qBAAqB,oBAAoB,mDAigBjE,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Input, Modal, Switch, message } from "antd";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { GroupMemberRole, MessageReceiveOptType } from "@droppii-org/wasm-client-sdk";
|
|
5
|
+
import { GroupMemberRole, GroupStatus, MessageReceiveOptType } from "@droppii-org/wasm-client-sdk";
|
|
6
6
|
import { Icon } from "../../components/icon";
|
|
7
7
|
import useConversationStore from "../../store/conversation";
|
|
8
8
|
import { useLeaveConversation } from "../../hooks/session/useLeaveConversation";
|
|
@@ -38,13 +38,16 @@ const GroupThreadInfo = ({ onClose, config }) => {
|
|
|
38
38
|
const [activeRow, setActiveRow] = useState(null);
|
|
39
39
|
const [notifyEnabled, setNotifyEnabled] = useState((conversationData === null || conversationData === void 0 ? void 0 : conversationData.recvMsgOpt) !== MessageReceiveOptType.NotNotify);
|
|
40
40
|
const avatarInputRef = useRef(null);
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
const [allowSendMessage, setAllowSendMessage] = useState(
|
|
41
|
+
// changeGroupMute() persists via GroupItem.status (GroupStatus.Muted),
|
|
42
|
+
// refreshed into currentGroupInfo on OnGroupInfoChanged — same pattern as
|
|
43
|
+
// notifyEnabled below, not a locally-tracked flag.
|
|
44
|
+
const [allowSendMessage, setAllowSendMessage] = useState((currentGroupInfo === null || currentGroupInfo === void 0 ? void 0 : currentGroupInfo.status) !== GroupStatus.Muted);
|
|
45
45
|
useEffect(() => {
|
|
46
46
|
setNotifyEnabled((conversationData === null || conversationData === void 0 ? void 0 : conversationData.recvMsgOpt) !== MessageReceiveOptType.NotNotify);
|
|
47
47
|
}, [conversationData === null || conversationData === void 0 ? void 0 : conversationData.recvMsgOpt]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setAllowSendMessage((currentGroupInfo === null || currentGroupInfo === void 0 ? void 0 : currentGroupInfo.status) !== GroupStatus.Muted);
|
|
50
|
+
}, [currentGroupInfo === null || currentGroupInfo === void 0 ? void 0 : currentGroupInfo.status]);
|
|
48
51
|
const { mutate: updateGroupInfo } = useUpdateGroupInfo();
|
|
49
52
|
const { mutate: uploadFile, isPending: isAvatarUploading } = useUploadFile();
|
|
50
53
|
const { mutate: toggleSendMessage, isPending: isTogglingSendMessage } = useToggleGroupSendMessage();
|
|
@@ -110,14 +113,16 @@ const GroupThreadInfo = ({ onClose, config }) => {
|
|
|
110
113
|
const handleToggleNotification = (checked) => {
|
|
111
114
|
if (!conversationID)
|
|
112
115
|
return;
|
|
113
|
-
const previous = notifyEnabled;
|
|
114
116
|
setNotifyEnabled(checked);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
// setConversationRecvMessageOpt's promise settling is not the source of
|
|
118
|
+
// truth for whether the update actually persisted — like createGroup()
|
|
119
|
+
// (see useGlobalEvent.ts's joinedGroupAddedHandler comment), the WS
|
|
120
|
+
// round-trip can reject/timeout client-side even when the server-side
|
|
121
|
+
// update succeeds moments later. The real state always arrives via
|
|
122
|
+
// OnConversationChanged, which the useEffect above already syncs into
|
|
123
|
+
// notifyEnabled — so don't revert optimistic state or show a failure
|
|
124
|
+
// toast here, or we show a false error for updates that did succeed.
|
|
125
|
+
toggleNotification({ conversationID, notify: checked });
|
|
121
126
|
};
|
|
122
127
|
const handleToggleSendMessage = (checked) => {
|
|
123
128
|
if (!groupID)
|