googlechat: fix space type detection for modern API
This commit is contained in:
1 parent
a109b7f1a9
commit
145019d6f8
2 files changed
+13
-2
No files matched your search
@@ -387,8 +387,17 @@ async function processMessageWithPipeline(params: {
|
||||
|
||||
const spaceId = space.name ?? "";
|
||||
if (!spaceId) return;
|
||||
const spaceType = (space.type ?? "").toUpperCase();
|
||||
const isGroup = spaceType !== "DM";
|
||||
|
||||
// Normalize to modern 'spaceType' format
|
||||
let spaceType = (space.spaceType ?? "").toUpperCase();
|
||||
|
||||
// @deprecated fallback: map legacy 'type' to modern values
|
||||
if (!spaceType && space.type) {
|
||||
const legacyType = space.type.toUpperCase();
|
||||
spaceType = legacyType === "DM" ? "DIRECT_MESSAGE" : "SPACE";
|
||||
}
|
||||
|
||||
const isGroup = spaceType !== "DIRECT_MESSAGE";
|
||||
const sender = message.sender ?? event.user;
|
||||
const senderId = sender?.name ?? "";
|
||||
const senderName = sender?.displayName ?? "";
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
export type GoogleChatSpace = {
|
||||
name?: string;
|
||||
displayName?: string;
|
||||
/** @deprecated Use spaceType instead */
|
||||
type?: string;
|
||||
spaceType?: string;
|
||||
};
|
||||
|
||||
export type GoogleChatUser = {
|
||||
|
||||
Reference in new issue
Block a user