Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require invite limit #1748

Merged
merged 3 commits into from
Dec 28, 2024
Merged

Require invite limit #1748

merged 3 commits into from
Dec 28, 2024

Conversation

ekzyis
Copy link
Member

@ekzyis ekzyis commented Dec 20, 2024

Description

The frontend says invite limit is optional but if you don't enter anything and submit, we throw

Variable "$limit" got invalid value ""; Int cannot represent non-integer value: ""

I believe this has been an issue even before #1649 since the validation schema was not changed in #1649 and I had to update it to use .nullable().

Additionally, our code checked if invite.limit was defined everywhere except in the most critical part where it gets redeemed, lol.

Checklist

Are your changes backwards compatible? Please answer below:

yes

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:

6. Testing creating and redeeming limited and unlimited invite links.

For frontend changes: Tested on mobile, light and dark mode? Please answer below:

n/a

Did you introduce any new environment variables? If so, call them out explicitly here:

no

@ekzyis ekzyis added the bug label Dec 20, 2024
@ekzyis ekzyis changed the title Fix invite links required Fix invite limit required Dec 20, 2024
@ekzyis ekzyis force-pushed the fix-invite-links-required branch from 57cbbb5 to de39640 Compare December 20, 2024 11:53
@ekzyis ekzyis marked this pull request as draft December 20, 2024 11:54
@ekzyis ekzyis marked this pull request as ready for review December 20, 2024 12:04
@ekzyis ekzyis requested a review from huumn December 21, 2024 12:07
@huumn
Copy link
Member

huumn commented Dec 21, 2024

Given the way these are abused, I think the move is to make the limit required.

Since we merged user specified invite codes, having a limit is even more important, because we'll no doubt have people creating invite links like /invites/grayruby, ie the equivalent of people setting a password to password.

@ekzyis ekzyis force-pushed the fix-invite-links-required branch from a8319a5 to f27be13 Compare December 23, 2024 13:18
@ekzyis
Copy link
Member Author

ekzyis commented Dec 23, 2024

I see, makes sense, made the invite limit required for the mutation in f27be13 but didn't enforce it in the database because I am not sure how to deal with existing unlimited invites:

> SELECT COUNT(1) FROM "Invite" WHERE "limit" IS NULL;
256
> SELECT COUNT(1) FROM "Invite" WHERE "limit" IS NULL AND "revoked" = 'f';
179

I think we should first just make creating new unlimited invites impossible (this PR), announce that we will delete any unlimited invite in X weeks, then delete them and then make the Invite.limit column non-nullable.

@ekzyis ekzyis changed the title Fix invite limit required Require invite limit Dec 28, 2024
@huumn huumn merged commit 9783df8 into master Dec 28, 2024
6 checks passed
@huumn huumn deleted the fix-invite-links-required branch December 28, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants