Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Removing away (DB related, not slot related) from code #14673

Merged
merged 2 commits into from
Apr 20, 2024
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
2 changes: 0 additions & 2 deletions apps/api/v1/lib/validations/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export const schemaUserBaseBodyParams = User.pick({
brandColor: true,
darkBrandColor: true,
allowDynamicBooking: true,
away: true,
role: true,
// @note: disallowing avatar changes via API for now. We can add it later if needed. User should upload image via UI.
// avatar: true,
Expand Down Expand Up @@ -171,7 +170,6 @@ export const schemaUserReadPublic = User.pick({
brandColor: true,
darkBrandColor: true,
allowDynamicBooking: true,
away: true,
createdDate: true,
verified: true,
invitedTo: true,
Expand Down
3 changes: 0 additions & 3 deletions apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ async function getUserPageProps(context: GetServerSidePropsContext) {
});

let name: string;
let isAway = false;
let hideBranding = false;

const notFound = {
Expand Down Expand Up @@ -96,7 +95,6 @@ async function getUserPageProps(context: GetServerSidePropsContext) {
}

name = username;
isAway = user.away;
hideBranding = user.hideBranding;
}

Expand Down Expand Up @@ -129,7 +127,6 @@ async function getUserPageProps(context: GetServerSidePropsContext) {
eventData.length
),
booking,
away: isAway,
user: name,
slug,
trpcState: ssr.dehydrate(),
Expand Down
1 change: 0 additions & 1 deletion apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
const session = await getServerSession(context);
const { slug: teamSlug, type: meetingSlug } = paramsSchema.parse(context.params);
const { rescheduleUid, duration: queryDuration, isInstantMeeting: queryIsInstantMeeting } = context.query;

Check warning on line 26 in apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx#L26

[@typescript-eslint/no-unused-vars] 'queryDuration' is assigned a value but never used. Allowed unused vars must match /^_/u.
const { ssrInit } = await import("@server/lib/ssr");
const ssr = await ssrInit(context);
const { currentOrgDomain, isValidOrgDomain } = orgDomainConfig(context.req, context.params?.orgSlug);
Expand Down Expand Up @@ -89,7 +89,6 @@
metadata: eventData.metadata,
},
booking,
away: false,
user: teamSlug,
teamId: team.id,
slug: meetingSlug,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type UserPageProps = {
allowSEOIndexing: boolean;
username: string | null;
};
users: (Pick<User, "away" | "name" | "username" | "bio" | "verified" | "avatarUrl"> & {
users: (Pick<User, "name" | "username" | "bio" | "verified" | "avatarUrl"> & {
profile: UserProfile;
})[];
themeBasis: string | null;
Expand Down Expand Up @@ -177,7 +177,6 @@ export const getServerSideProps: GetServerSideProps<UserPageProps> = async (cont
avatarUrl: user.avatarUrl,
verified: user.verified,
profile: user.profile,
away: user.away,
})),
entity: {
...(org?.logoUrl ? { logoUrl: org?.logoUrl } : {}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ async function getDynamicGroupPageProps(context: GetServerSidePropsContext) {
booking,
user: usernames.join("+"),
slug,
away: false,
trpcState: ssr.dehydrate(),
isBrandingHidden: false,
isSEOIndexable: true,
Expand Down Expand Up @@ -165,7 +164,6 @@ async function getUserPageProps(context: GetServerSidePropsContext) {
},
user: username,
slug,
away: false,
trpcState: ssr.dehydrate(),
isBrandingHidden: user?.hideBranding,
isSEOIndexable: user?.allowSEOIndexing,
Expand Down
2 changes: 0 additions & 2 deletions apps/web/modules/users/views/users-type-public-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default function Type({
user,
isEmbed,
booking,
away,
isBrandingHidden,
isSEOIndexable,
rescheduleUid,
Expand All @@ -47,7 +46,6 @@ export default function Type({
username={user}
eventSlug={slug}
bookingData={booking}
isAway={away}
hideBranding={isBrandingHidden}
entity={eventData.entity}
durationConfig={eventData.metadata?.multipleDuration}
Expand Down
2 changes: 0 additions & 2 deletions apps/web/pages/d/[link]/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default function Type({
isEmbed,
user,
booking,
away,
isBrandingHidden,
isTeamEvent,
entity,
Expand All @@ -33,7 +32,6 @@ export default function Type({
username={user}
eventSlug={slug}
bookingData={booking}
isAway={away}
hideBranding={isBrandingHidden}
isTeamEvent={isTeamEvent}
entity={entity}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default function Type({
slug,
user,
booking,
away,
isEmbed,
isBrandingHidden,
entity,
Expand All @@ -42,7 +41,6 @@ export default function Type({
username={user}
eventSlug={slug}
bookingData={booking}
isAway={away}
hideBranding={isBrandingHidden}
isTeamEvent
isInstantMeeting
Expand Down Expand Up @@ -110,7 +108,6 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
eventData.length
),
booking: null,
away: false,
user: teamSlug,
teamId: team.id,
slug: meetingSlug,
Expand Down
2 changes: 0 additions & 2 deletions apps/web/pages/team/[slug]/[type].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default function Type({
slug,
user,
booking,
away,
isEmbed,
isBrandingHidden,
eventData,
Expand All @@ -54,7 +53,6 @@ export default function Type({
username={user}
eventSlug={slug}
bookingData={booking}
isAway={away}
isInstantMeeting={isInstantMeeting}
hideBranding={isBrandingHidden}
isTeamEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const getSampleUserInSession = function () {
identityProvider: IdentityProvider.CAL,
brandColor: "#292929",
darkBrandColor: "#fafafa",
away: false,
metadata: null,
role: UserPermissionRole.USER,
disableImpersonation: false,
Expand Down
5 changes: 0 additions & 5 deletions packages/features/bookings/Booker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ export interface BookerProps {
selectedDate?: Date;

hideBranding?: boolean;
/**
* Sets the Booker component to the away state.
* This is NOT revalidated by calling the API.
*/
isAway?: boolean;
/**
* If false and the current username indicates a dynamic booking,
* the Booker will immediately show an error.
Expand Down
1 change: 0 additions & 1 deletion packages/features/ee/users/server/trpc-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const userBodySchema = User.pick({
// darkBrandColor: true,
allowDynamicBooking: true,
identityProvider: true,
// away: true,
role: true,
avatarUrl: true,
});
Expand Down
22 changes: 0 additions & 22 deletions packages/features/shell/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,29 +397,7 @@ function UserDropdown({ small }: UserDropdownProps) {
screenResolution: `${screen.width}x${screen.height}`,
});
});
const mutation = trpc.viewer.away.useMutation({
onMutate: async ({ away }) => {
await utils.viewer.me.cancel();

const previousValue = utils.viewer.me.getData();

if (previousValue) {
utils.viewer.me.setData(undefined, { ...previousValue, away });
}

return { previousValue };
},
onError: (_, __, context) => {
if (context?.previousValue) {
utils.viewer.me.setData(undefined, context.previousValue);
}

showToast(t("toggle_away_error"), "error");
},
onSettled() {
utils.viewer.me.invalidate();
},
});
const [helpOpen, setHelpOpen] = useState(false);
const [menuOpen, setMenuOpen] = useState(false);

Expand Down
1 change: 0 additions & 1 deletion packages/lib/server/repository/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const userSelect = Prisma.validator<Prisma.UserSelect>()({
invitedTo: true,
brandColor: true,
darkBrandColor: true,
away: true,
allowDynamicBooking: true,
allowSEOIndexing: true,
receiveMonthlyDigestEmail: true,
Expand Down
2 changes: 0 additions & 2 deletions packages/lib/test/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ type UserPayload = Prisma.UserGetPayload<{
selectedCalendars: true;
schedules: true;
avatarUrl: true;
away: true;
backupCodes: true;
bio: true;
brandColor: true;
Expand Down Expand Up @@ -255,7 +254,6 @@ export const buildUser = <T extends Partial<UserPayload>>(
allowDynamicBooking: true,
availability: [],
avatarUrl: "",
away: false,
backupCodes: null,
bio: null,
brandColor: "#292929",
Expand Down
1 change: 0 additions & 1 deletion packages/trpc/server/middlewares/sessionMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export async function getUserFromSession(ctx: TRPCContextInner, session: Maybe<S
identityProviderId: true,
brandColor: true,
darkBrandColor: true,
away: true,
movedToProfileId: true,
selectedCalendars: {
select: {
Expand Down
15 changes: 0 additions & 15 deletions packages/trpc/server/routers/loggedInViewer/_router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { router } from "../../trpc";
import { ZAddSecondaryEmailInputSchema } from "./addSecondaryEmail.schema";
import { ZAppByIdInputSchema } from "./appById.schema";
import { ZAppCredentialsByTypeInputSchema } from "./appCredentialsByType.schema";
import { ZAwayInputSchema } from "./away.schema";
import { ZConnectAndJoinInputSchema } from "./connectAndJoin.schema";
import { ZConnectedCalendarsInputSchema } from "./connectedCalendars.schema";
import { ZDeleteCredentialInputSchema } from "./deleteCredential.schema";
Expand All @@ -28,7 +27,6 @@ type AppsRouterHandlerCache = {
shouldVerifyEmail?: typeof import("./shouldVerifyEmail.handler").shouldVerifyEmailHandler;
deleteMe?: typeof import("./deleteMe.handler").deleteMeHandler;
deleteMeWithoutPassword?: typeof import("./deleteMeWithoutPassword.handler").deleteMeWithoutPasswordHandler;
away?: typeof import("./away.handler").awayHandler;
connectedCalendars?: typeof import("./connectedCalendars.handler").connectedCalendarsHandler;
setDestinationCalendar?: typeof import("./setDestinationCalendar.handler").setDestinationCalendarHandler;
integrations?: typeof import("./integrations.handler").integrationsHandler;
Expand Down Expand Up @@ -91,19 +89,6 @@ export const loggedInViewerRouter = router({
return UNSTABLE_HANDLER_CACHE.deleteMeWithoutPassword({ ctx });
}),

away: authedProcedure.input(ZAwayInputSchema).mutation(async ({ ctx, input }) => {
if (!UNSTABLE_HANDLER_CACHE.away) {
UNSTABLE_HANDLER_CACHE.away = (await import("./away.handler")).awayHandler;
}

// Unreachable code but required for type safety
if (!UNSTABLE_HANDLER_CACHE.away) {
throw new Error("Failed to load handler");
}

return UNSTABLE_HANDLER_CACHE.away({ ctx, input });
}),

connectedCalendars: authedProcedure.input(ZConnectedCalendarsInputSchema).query(async ({ ctx, input }) => {
if (!UNSTABLE_HANDLER_CACHE.connectedCalendars) {
UNSTABLE_HANDLER_CACHE.connectedCalendars = (
Expand Down
22 changes: 0 additions & 22 deletions packages/trpc/server/routers/loggedInViewer/away.handler.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/trpc/server/routers/loggedInViewer/away.schema.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/trpc/server/routers/loggedInViewer/me.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export const meHandler = async ({ ctx, input }: MeOptions) => {
identityProviderEmail,
brandColor: user.brandColor,
darkBrandColor: user.darkBrandColor,
away: user.away,
bio: user.bio,
weekStart: user.weekStart,
theme: user.theme,
Expand Down
Loading