Skip to content
Snippets Groups Projects
Unverified Commit 41ca8be7 authored by pierre-lehnen-rc's avatar pierre-lehnen-rc Committed by GitHub
Browse files

[FIX] findOrCreateInvite REST endpoint ignoring `days` and `maxUses` params (#18565)

parent b913621b
No related branches found
No related tags found
No related merge requests found
......@@ -46,14 +46,14 @@ export const findOrCreateInvite = (userId, invite) => {
throw new Meteor.Error('error-room-type-not-allowed', 'Cannot create invite links for this room type', { method: 'findOrCreateInvite' });
}
let { days, maxUses } = invite;
const { days = 1, maxUses = 0 } = invite;
if (!possibleDays.includes(days)) {
days = 1;
throw new Meteor.Error('invalid-number-of-days', 'Invite should expire in 1, 7, 15 or 30 days, or send 0 to never expire.');
}
if (!possibleUses.includes(maxUses)) {
maxUses = 0;
throw new Meteor.Error('invalid-number-of-uses', 'Invite should be valid for 1, 5, 10, 25, 50, 100 or infinite (0) uses.');
}
// Before anything, let's check if there's an existing invite with the same settings for the same channel and user and that has not yet expired.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment