(server: ServerWithFlags, plans: Plan[])
| 134 | } |
| 135 | |
| 136 | export function assertIsOnPlan(server: ServerWithFlags, plans: Plan[]) { |
| 137 | if (!plans.some((plan) => plan === server.plan)) { |
| 138 | return new TRPCError({ |
| 139 | code: 'FORBIDDEN', |
| 140 | message: `You are not on the correct plan to do this. You are on the ${ |
| 141 | server.plan |
| 142 | } plan, but you need to be on the ${plans.join(' or ')} plan`, |
| 143 | }); |
| 144 | } |
| 145 | return; |
| 146 | } |
| 147 | |
| 148 | export function assertCanEditMessage(ctx: Context, authorId: string) { |
| 149 | if (isSuperUser(ctx)) return; |
no outgoing calls
no test coverage detected