Skip to content

Commit

Permalink
unknown users now returns null field
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Nov 17, 2024
1 parent 2e98879 commit fc5897a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/common/bandage_response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export const generate_response = (data: BandageFull[], session: Session | null,
creation_date: el.creationDate,
stars_count: el.stars.length,
starred: el.stars.some(val => val.id == session?.user.id),
author: {
id: el.User?.id,
name: el.User?.reserved_name || el.User?.name,
username: el.User?.username,
public: el.User && Number(el.User?.discordId) > 0 ? el.User?.UserSettings?.public_profile : false
},
author: el.User ? {
id: el.User.id,
name: el.User.reserved_name || el.User.name,
username: el.User.username,
public: el.User && Number(el.User.discordId) > 0 ? el.User.UserSettings?.public_profile : false
} : null,
categories: categories.filter(el => el !== undefined)
}
});
Expand Down
12 changes: 6 additions & 6 deletions src/workshop/bandage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,12 @@ export class BandageService {
creation_date: bandage.creationDate,
stars_count: bandage.stars.length,
starred: bandage.stars.some(val => val.id == session?.user.id),
author: {
id: bandage.User?.id,
name: bandage.User?.reserved_name || bandage.User?.name,
username: bandage.User?.username,
public: bandage.User && Number(bandage.User?.discordId) > 0 ? bandage.User?.UserSettings?.public_profile : false
},
author: bandage.User ? {
id: bandage.User.id,
name: bandage.User.reserved_name || bandage.User.name,
username: bandage.User.username,
public: bandage.User && Number(bandage.User.discordId) > 0 ? bandage.User.UserSettings?.public_profile : false
} : null,
categories: categories,
me_profile: me_profile,
permissions_level: permissions_level,
Expand Down

0 comments on commit fc5897a

Please sign in to comment.