feat: add Activity type system, DB migration, and self-only showActivity in sanitizeUser
- Add Activity, ActivityType, ActivityTimestamps, ActivityAssets types to shared types - Add activity_update client event and activities field on presence_update server event - Add userActivities to ready payload and showActivity to User/UpdateUserRequest - Create shared activities.ts with ACTIVITY_LIMITS, ACTIVITY_PRIORITY, getPrimaryActivity - Add show_activity column to users table (schema + migration) - Update sanitizeUser with isSelf parameter; only include showActivity for self - Fix .map(sanitizeUser) calls to use arrow wrapper to prevent index-as-boolean bug - Mark auth routes (register/login) as isSelf=true since they return own user data
This commit is contained in:
@@ -682,7 +682,7 @@ function buildReadyPayload(userId: string): {
|
||||
if (!userRow) {
|
||||
throw new Error('User not found');
|
||||
}
|
||||
const user = sanitizeUser(userRow);
|
||||
const user = sanitizeUser(userRow, true);
|
||||
|
||||
// Get user's space memberships
|
||||
const memberships = db.select()
|
||||
@@ -931,7 +931,7 @@ function buildReadyPayload(userId: string): {
|
||||
const members = memberRows
|
||||
.map(m => dmUserMap.get(m.userId))
|
||||
.filter((u): u is NonNullable<typeof u> => u != null)
|
||||
.map(sanitizeUser);
|
||||
.map(u => sanitizeUser(u));
|
||||
|
||||
const last = dmLastMsgMap.get(dm.dmChannelId) ?? null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user