googlechat: fix space type detection for modern API

This commit is contained in:
Gustavo Zirbes 2026-01-29 13:32:45 +10:30
parent a109b7f1a9
commit 145019d6f8
2 changed files with 13 additions and 2 deletions

View File

@ -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 ?? "";

View File

@ -1,7 +1,9 @@
export type GoogleChatSpace = {
name?: string;
displayName?: string;
/** @deprecated Use spaceType instead */
type?: string;
spaceType?: string;
};
export type GoogleChatUser = {