mirror of
https://github.com/spacebarchat/server.git
synced 2026-04-27 02:05:20 +00:00
add extraFields optional param on toPrivateUser, expose rights on READY
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user