chore: Remove all avatar/logo references (#14532)
* chore: Remove all avatar/logo references * Updated user profile to only use avatarUrl * fix: minor style issue * chore: Remove redundant includeTeamLogo * fix: Use right avatar default in event type list * fix: placeholder avatar team profile, target * chore: Add logoUrl/avatarUrl to JWT * fix: Bunch of org avatar issues, fix members list * Fix logoUrl on org pages * More type fixes * Hopefully final type fixes * Another round of type fixes * fix: UserForm ts * fix: Handle as return types, not input types * fix: Remove profile and add avatarUrl * fix: notFound as const * fix: Seeder avatarUrl params * revert: Migration changes for easier recovery * fix: Add explicit type to builder as avatar is now set * Add logoUrl to unpublished entity * Avatar test out of scope here * fix: Use the new avatarUrl after save * chore: Removed getOrgAvatarUrl/getTeamAvatarUrl * fix: Update sidebar image immediately after change * Unable to safe unnamed user, so default * fix: Unpublished page, add organization test * Add more tests
This commit is contained in:
1 parent
5695ba7c13
commit
d25c043046
73 files changed
+644
-770
No files matched your search
@@ -1,8 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { getOrgFullOrigin } from "@calcom/ee/organizations/lib/orgDomains";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { AVATAR_FALLBACK } from "@calcom/lib/constants";
|
||||
import { RedirectType } from "@calcom/prisma/enums";
|
||||
import { _UserModel as User } from "@calcom/prisma/zod";
|
||||
import type { inferRouterOutputs } from "@calcom/trpc";
|
||||
@@ -32,30 +30,9 @@ const userBodySchema = User.pick({
|
||||
identityProvider: true,
|
||||
// away: true,
|
||||
role: true,
|
||||
avatar: true,
|
||||
avatarUrl: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated in favour of @calcom/lib/getAvatarUrl
|
||||
*/
|
||||
/** This helps to prevent reaching the 4MB payload limit by avoiding base64 and instead passing the avatar url */
|
||||
export function getAvatarUrlFromUser(user: {
|
||||
avatar: string | null;
|
||||
username: string | null;
|
||||
email: string;
|
||||
}) {
|
||||
if (!user.avatar || !user.username) return AVATAR_FALLBACK;
|
||||
return `${WEBAPP_URL}/${user.username}/avatar.png`;
|
||||
}
|
||||
|
||||
/** @see https://www.prisma.io/docs/concepts/components/prisma-client/excluding-fields#excluding-the-password-field */
|
||||
function exclude<UserType, Key extends keyof UserType>(user: UserType, keys: Key[]): Omit<UserType, Key> {
|
||||
for (const key of keys) {
|
||||
delete user[key];
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/** Reusable logic that checks for admin permissions and if the requested user exists */
|
||||
//const authedAdminWithUserMiddleware = middleware();
|
||||
|
||||
@@ -83,15 +60,7 @@ export const userAdminRouter = router({
|
||||
const { prisma } = ctx;
|
||||
// TODO: Add search, pagination, etc.
|
||||
const users = await prisma.user.findMany();
|
||||
return users.map((user) => ({
|
||||
...user,
|
||||
/**
|
||||
* FIXME: This should be either a prisma extension or middleware
|
||||
* @see https://www.prisma.io/docs/concepts/components/prisma-client/middleware
|
||||
* @see https://www.prisma.io/docs/concepts/components/prisma-client/client-extensions/result
|
||||
**/
|
||||
avatar: getAvatarUrlFromUser(user),
|
||||
}));
|
||||
return users;
|
||||
}),
|
||||
add: authedAdminProcedure.input(userBodySchema).mutation(async ({ ctx, input }) => {
|
||||
const { prisma } = ctx;
|
||||
|
||||
Reference in new issue
Block a user