(ctx: Context, targetServerId: string)
| 157 | } |
| 158 | |
| 159 | export function assertIsUserInServer(ctx: Context, targetServerId: string) { |
| 160 | if (isSuperUser(ctx)) return; |
| 161 | if (!ctx.userServers) { |
| 162 | return new TRPCError({ |
| 163 | code: 'UNAUTHORIZED', |
| 164 | message: 'Sign in to view this server', |
| 165 | }); |
| 166 | } |
| 167 | const server = ctx.userServers.find((server) => server.id === targetServerId); |
| 168 | if (!server) { |
| 169 | return new TRPCError({ |
| 170 | code: 'UNAUTHORIZED', |
| 171 | message: 'You are not a part of this server', |
| 172 | }); |
| 173 | } |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | export async function assertIsNotIgnoredAccount( |
| 178 | ctx: Context, |
nothing calls this directly
no test coverage detected