fix and update
This commit is contained in:
@@ -68,6 +68,25 @@ export class MediaService {
|
||||
return { userId, hasAvatar: true };
|
||||
}
|
||||
|
||||
async createFedcmAvatarUrl(userId: string): Promise<string | undefined> {
|
||||
const user = await this.prisma.user.findUnique({ where: { id: userId } });
|
||||
if (!user) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const legacyUrl = user.avatarUrl?.trim();
|
||||
if (legacyUrl) {
|
||||
return legacyUrl;
|
||||
}
|
||||
|
||||
if (!user.avatarStorageKey) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { accessUrl } = await this.createStreamAccessUrl(user.avatarStorageKey, userId);
|
||||
return accessUrl;
|
||||
}
|
||||
|
||||
async getAvatarAccessUrl(requesterId: string, targetUserId: string) {
|
||||
const user = await this.prisma.user.findUnique({ where: { id: targetUserId } });
|
||||
if (!user?.avatarStorageKey) {
|
||||
|
||||
Reference in New Issue
Block a user