googlechat: fix space type detection for modern API
This commit is contained in:
parent
a109b7f1a9
commit
145019d6f8
@ -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 = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user