添加是否为成员和是否为管理员的字段

This commit is contained in:
CrescentLeaf
2025-10-19 15:11:40 +08:00
parent 5e44a273fc
commit 5034eb1da5
2 changed files with 9 additions and 2 deletions

View File

@@ -7,5 +7,8 @@ export default class Chat {
declare avatar?: string
declare settings?: { [key: string]: unknown }
declare is_member: boolean
declare is_admin: boolean
[key: string]: unknown
}

View File

@@ -58,6 +58,8 @@ export default class ChatApi extends BaseApi {
title: chat.getTitle(mine),
avatar: chat.getAvatarFileHash(mine) ? "uploaded_files/" + chat.getAvatarFileHash(mine) : undefined,
settings: JSON.parse(chat.bean.settings),
is_member: true,
is_admin: true,
}
}
}
@@ -71,13 +73,15 @@ export default class ChatApi extends BaseApi {
title: chat.getTitle(),
avatar: chat.getAvatarFileHash() ? "uploaded_files/" + chat.getAvatarFileHash() : undefined,
settings: JSON.parse(chat.bean.settings),
is_member: UserChatLinker.checkUserIsLinkedToChat(token.author, chat!.bean.id),
is_admin: chat.checkUserIsAdmin(token.author),
}
}
}
return {
code: 501,
msg: "not implmented",
code: 404,
msg: "找不到对话",
}
})
/**