@shaxpir/duiduidui-models 1.24.2 → 1.24.3
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.
- package/dist/models/Chat.d.ts +2 -2
- package/dist/models/Chat.js +6 -8
- package/package.json +1 -1
package/dist/models/Chat.d.ts
CHANGED
|
@@ -63,9 +63,9 @@ export interface ChatScratchpad {
|
|
|
63
63
|
}
|
|
64
64
|
export interface ChatStub {
|
|
65
65
|
id: ContentId;
|
|
66
|
-
title
|
|
66
|
+
title: string | null;
|
|
67
67
|
participants: SocialUser[];
|
|
68
|
-
last_message_preview
|
|
68
|
+
last_message_preview: string | null;
|
|
69
69
|
updated_at: CompactDateTime;
|
|
70
70
|
has_unread: {
|
|
71
71
|
[user_id: string]: boolean;
|
package/dist/models/Chat.js
CHANGED
|
@@ -62,12 +62,10 @@ class Chat extends SharedContent_1.SharedContent {
|
|
|
62
62
|
for (const userId of userIds) {
|
|
63
63
|
try {
|
|
64
64
|
const workspaceId = shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.WORKSPACE);
|
|
65
|
-
const workspace = this.shareSync.
|
|
66
|
-
if (workspace) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
workspace.upsertChatStub(stub);
|
|
70
|
-
}
|
|
65
|
+
const workspace = await this.shareSync.acquire(ContentKind_1.ContentKind.WORKSPACE, workspaceId);
|
|
66
|
+
if (workspace && workspace.exists()) {
|
|
67
|
+
// Cast needed to avoid circular dependency between Chat and Workspace
|
|
68
|
+
workspace.upsertChatStub(stub);
|
|
71
69
|
workspace.release();
|
|
72
70
|
}
|
|
73
71
|
}
|
|
@@ -166,7 +164,7 @@ class Chat extends SharedContent_1.SharedContent {
|
|
|
166
164
|
toStub() {
|
|
167
165
|
this.checkDisposed('Chat.toStub');
|
|
168
166
|
const msgs = this.messages.values;
|
|
169
|
-
let preview;
|
|
167
|
+
let preview = null;
|
|
170
168
|
if (msgs.length > 0) {
|
|
171
169
|
const lastMsg = msgs[msgs.length - 1];
|
|
172
170
|
const textBlock = lastMsg.content.find(b => b.type === 'text');
|
|
@@ -181,7 +179,7 @@ class Chat extends SharedContent_1.SharedContent {
|
|
|
181
179
|
}
|
|
182
180
|
return {
|
|
183
181
|
id: this.id,
|
|
184
|
-
title: this.title,
|
|
182
|
+
title: this.title || null,
|
|
185
183
|
participants: this.participants.values,
|
|
186
184
|
last_message_preview: preview,
|
|
187
185
|
updated_at: this.updatedAt.utc_time,
|