add extraFields optional param on toPrivateUser, expose rights on READY

This commit is contained in:
Rory&
2025-11-22 19:43:16 +01:00
parent ab6a1b7104
commit 592d68379b
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -519,7 +519,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
const d: ReadyEventData = {
v: 9,
application: application ? { id: application.id, flags: application.flags } : undefined,
user: user.toPrivateUser(),
user: user.toPrivateUser(["rights"]),
user_settings: user.settings,
user_settings_proto: settingsProtos?.userSettings ? PreloadedUserSettings.toBase64(settingsProtos.userSettings) : undefined,
user_settings_proto_json: settingsProtos?.userSettings ? PreloadedUserSettings.toJson(settingsProtos.userSettings) : undefined,
+2 -2
View File
@@ -197,10 +197,10 @@ export class User extends BaseClass {
return user as PublicUser;
}
toPrivateUser() {
toPrivateUser(extraFields: (keyof User)[] = []) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const user: any = {};
PrivateUserProjection.forEach((x) => {
[...PrivateUserProjection, ...extraFields].forEach((x) => {
user[x] = this[x];
});
return user as UserPrivate;