summary refs log tree commit diff
path: root/api/src/util/handlers
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-07 23:34:43 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-07 23:34:43 +1000
commite1ebfe79d21930592a7cf937f58a147ddde2b01b (patch)
treeba4a7f3e4b1b8f697694e11bbd7cab460337d53e /api/src/util/handlers
parentEnsure password was given if email is given in PATCH @me (diff)
parentFormat changed files (diff)
downloadserver-e1ebfe79d21930592a7cf937f58a147ddde2b01b.tar.xz
Merge branch 'master' into fix/claim_accounts
Diffstat (limited to 'api/src/util/handlers')
-rw-r--r--api/src/util/handlers/Message.ts3
-rw-r--r--api/src/util/handlers/route.ts3
2 files changed, 5 insertions, 1 deletions
diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts

index 5a5ac666..e9f0ac55 100644 --- a/api/src/util/handlers/Message.ts +++ b/api/src/util/handlers/Message.ts
@@ -91,7 +91,8 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { if (opts.message_reference.channel_id !== opts.channel_id) throw new HTTPError("You can only reference messages from this channel"); } } - // Q: should be checked if the referenced message exists? ANSWER: NO + /** Q: should be checked if the referenced message exists? ANSWER: NO + otherwise backfilling won't work **/ // @ts-ignore message.type = MessageType.REPLY; } diff --git a/api/src/util/handlers/route.ts b/api/src/util/handlers/route.ts
index 0048c4dd..3d3bbc37 100644 --- a/api/src/util/handlers/route.ts +++ b/api/src/util/handlers/route.ts
@@ -6,6 +6,7 @@ import { FieldErrors, FosscordApiErrors, getPermission, + getRights, PermissionResolvable, Permissions, RightResolvable, @@ -105,6 +106,8 @@ export function route(opts: RouteOptions) { if (opts.right) { const required = new Rights(opts.right); + req.rights = await getRights(req.user_id); + if (!req.rights || !req.rights.has(required)) { throw FosscordApiErrors.MISSING_RIGHTS.withParams(opts.right as string); }