Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/server-core/src/user/avatar/avatar.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ const updateUserAvatars = async (context: HookContext<AvatarService>) => {
query: {
id: {
$ne: context.id?.toString() as AvatarID
}
},
isPublic: true,
$limit: 1000
},
paginate: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aditya-mitra as we are specifiying limit in the query, then we shouldnt pass paginate:false. Also, the response should be considered as Paginated object instead of array.

})) as AvatarType[]
Expand Down
4 changes: 3 additions & 1 deletion packages/server-core/src/user/strategies/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class DiscordStrategy extends CustomOAuthStrategy {
{}
)
if (!entity.userId) {
const avatars = (await this.app.service(avatarPath).find({ isInternal: true })) as Paginated<AvatarType>
const avatars = (await this.app
.service(avatarPath)
.find({ isInternal: true, query: { isPublic: true, $limit: 1000 } })) as Paginated<AvatarType>
const code = (await getFreeInviteCode(this.app)) as InviteCode
const newUser = await this.app.service(userPath).create({
name: '' as UserName,
Expand Down
4 changes: 3 additions & 1 deletion packages/server-core/src/user/strategies/facebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class FacebookStrategy extends CustomOAuthStrategy {
{}
)
if (!entity.userId) {
const avatars = (await this.app.service(avatarPath).find({ isInternal: true })) as Paginated<AvatarType>
const avatars = (await this.app
.service(avatarPath)
.find({ isInternal: true, query: { isPublic: true, $limit: 1000 } })) as Paginated<AvatarType>
const code = (await getFreeInviteCode(this.app)) as InviteCode
const newUser = await this.app.service(userPath).create({
name: '' as UserName,
Expand Down
4 changes: 3 additions & 1 deletion packages/server-core/src/user/strategies/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export class GithubStrategy extends CustomOAuthStrategy {
{}
)
if (!entity.userId) {
const avatars = (await this.app.service(avatarPath).find({ isInternal: true })) as Paginated<AvatarType>
const avatars = (await this.app
.service(avatarPath)
.find({ isInternal: true, query: { isPublic: true, $limit: 1000 } })) as Paginated<AvatarType>
const code = (await getFreeInviteCode(this.app)) as InviteCode
const newUser = await this.app.service(userPath).create({
name: '' as UserName,
Expand Down
4 changes: 3 additions & 1 deletion packages/server-core/src/user/strategies/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class Googlestrategy extends CustomOAuthStrategy {
{}
)
if (!entity.userId) {
const avatars = (await this.app.service(avatarPath).find({ isInternal: true })) as Paginated<AvatarType>
const avatars = (await this.app
.service(avatarPath)
.find({ isInternal: true, query: { isPublic: true, $limit: 1000 } })) as Paginated<AvatarType>
const code = (await getFreeInviteCode(this.app)) as InviteCode
const newUser = await this.app.service(userPath).create({
name: '' as UserName,
Expand Down
4 changes: 3 additions & 1 deletion packages/server-core/src/user/strategies/linkedin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class LinkedInStrategy extends CustomOAuthStrategy {
{}
)
if (!entity.userId) {
const avatars = (await this.app.service(avatarPath).find({ isInternal: true })) as Paginated<AvatarType>
const avatars = (await this.app
.service(avatarPath)
.find({ isInternal: true, query: { isPublic: true, $limit: 1000 } })) as Paginated<AvatarType>
const code = (await getFreeInviteCode(this.app)) as InviteCode
const newUser = await this.app.service(userPath).create({
name: '' as UserName,
Expand Down
4 changes: 3 additions & 1 deletion packages/server-core/src/user/strategies/twitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class TwitterStrategy extends CustomOAuthStrategy {
{}
)
if (!entity.userId) {
const avatars = (await this.app.service(avatarPath).find({ isInternal: true })) as Paginated<AvatarType>
const avatars = (await this.app
.service(avatarPath)
.find({ isInternal: true, query: { isPublic: true, $limit: 1000 } })) as Paginated<AvatarType>
const code = (await getFreeInviteCode(this.app)) as InviteCode
const newUser = await this.app.service(userPath).create({
name: '' as UserName,
Expand Down