Yeah this is a bug… I don’t really see why we would do it this way anymore:
Which later calls:
To me it looks like we are simply missing a unique index on group_requests you should only ever be allowed to have one group request per group in flight.
The problem though is that we are being a bit over aggressive here:
So we should change this:
-
Add a unique index on
group_requests(group_id, user_id)so only one request can be in-flight -
Remove the rate limit it makes no sense
-
If someone (via api) requests membership to a group and they already have a request in flight, an error should be returned
-
If someone (via api) requests membership they are already a member of, an error should be returned
-
If someone (via api) requests membership to an invalid group (does not exists, or does not allow requests) an error should be returned.
I am on the fence about how to deal with repeat rejected group requests, BUT do not want to invent a problem here with fancy solutions, lets see what people say. I can think of cases where you would be rejected from a group one day, then provide better proof and then be accepted.
@nbianca can you sort this out?