feat: polish release v2 experience (#6800)
This commit is contained in:
1 parent
925b0fb801
commit
a4a903d7c3
295 files changed
+10627
-7115
No files matched your search
@@ -20,6 +20,7 @@ import {
|
||||
getHeaderItems,
|
||||
headerPreferencesMutationSchema,
|
||||
parseHeaderPreferences,
|
||||
userByteUnitSystemSchema,
|
||||
userChangeColorSchemeSchema,
|
||||
userChangeHomeBoardsSchema,
|
||||
userChangePasswordApiSchema,
|
||||
@@ -212,7 +213,7 @@ export const userRouter = createTRPCRouter({
|
||||
image: z
|
||||
.string()
|
||||
.regex(/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9/+]+=*$/g)
|
||||
.max(350000) // approximately 256KB in base64 (256 * 1024 * 4 / 3 + prefixes)
|
||||
.max(350000) // approximately 256 KiB in base64 (256 * 1024 * 4 / 3 + prefixes)
|
||||
.nullable(),
|
||||
}),
|
||||
)
|
||||
@@ -370,6 +371,7 @@ export const userRouter = createTRPCRouter({
|
||||
provider: true,
|
||||
homeBoardId: true,
|
||||
mobileHomeBoardId: true,
|
||||
byteUnitSystem: true,
|
||||
firstDayOfWeek: true,
|
||||
pingIconsEnabled: true,
|
||||
enableRightClickOnWidgets: true,
|
||||
@@ -408,6 +410,7 @@ export const userRouter = createTRPCRouter({
|
||||
provider: true,
|
||||
homeBoardId: true,
|
||||
mobileHomeBoardId: true,
|
||||
byteUnitSystem: true,
|
||||
firstDayOfWeek: true,
|
||||
pingIconsEnabled: true,
|
||||
enableRightClickOnWidgets: true,
|
||||
@@ -682,6 +685,38 @@ export const userRouter = createTRPCRouter({
|
||||
})
|
||||
.where(eq(users.id, ctx.session.user.id));
|
||||
}),
|
||||
changeByteUnitSystem: protectedProcedure
|
||||
.input(userByteUnitSystemSchema.and(byIdSchema))
|
||||
.output(z.void())
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
if (!ctx.session.user.permissions.includes("admin") && ctx.session.user.id !== input.id) {
|
||||
throw new TRPCError({
|
||||
code: "NOT_FOUND",
|
||||
message: "User not found",
|
||||
});
|
||||
}
|
||||
|
||||
const dbUser = await ctx.db.query.users.findFirst({
|
||||
columns: {
|
||||
id: true,
|
||||
},
|
||||
where: eq(users.id, input.id),
|
||||
});
|
||||
|
||||
if (!dbUser) {
|
||||
throw new TRPCError({
|
||||
code: "NOT_FOUND",
|
||||
message: "User not found",
|
||||
});
|
||||
}
|
||||
|
||||
await ctx.db
|
||||
.update(users)
|
||||
.set({
|
||||
byteUnitSystem: input.byteUnitSystem,
|
||||
})
|
||||
.where(eq(users.id, input.id));
|
||||
}),
|
||||
changeEnableRightClickOnWidgets: protectedProcedure
|
||||
.meta({
|
||||
openapi: {
|
||||
|
||||
Reference in new issue
Block a user