# How many times can one apply to a group?

**URL:** https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188
**Category:** Bug
**Created:** [16 april 2019 om 08:35 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188 "2019-04-16T08:35:49Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [16 april 2019 om 08:35 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188/1 "2019-04-16T08:35:50Z")

</div>

hi, in our forum it seems that one can try applying to a group once in every 24 hours.  
`We have a daily limit on how many times that action can be taken. Please wait 23 hours before trying again. `

is there a setting to change this limit?

I couldn’t find one. I’d appreciate for help and hints.

* * *

update: it seems that this limit is different for different forums, as reported 9 min in [this topic](https://meta.discourse.org/t/rate-limit-hit-when-joining-a-group/73661), but I couldn’t find where to tune this limit in the admin panel.

---

<div class="post-metadata">

### Author: ![Thomas\_G](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thomas_g/32/200158_2.png) [@Thomas\_G](https://meta.discourse.org/u/Thomas_G)
#### Post date: [16 april 2019 om 14:14 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188/2 "2019-04-16T14:14:53Z")

</div>

I get that too, but in a different message:

`You have performed this action too many times. Please wait XX hours before trying again.`

From what I saw in the `admin>customize` section this is coming from the `rate_limiter.too_many_requests` but I can’t find anything that will disable it or change it. Anyone knows how we can customize this rate\_limiter?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [17 april 2019 om 01:10 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188/3 "2019-04-17T01:10:38Z")

</div>

Yeah this is a bug… I don’t really see why we would do it this way anymore:

> <https://github.com/discourse/discourse/blob/35a866fe229ffe6a22b947a671c82c1bcc7dec51/app/controllers/groups_controller.rb#L411-L413>

Which later calls:

> <https://github.com/discourse/discourse/blob/35a866fe229ffe6a22b947a671c82c1bcc7dec51/app/controllers/groups_controller.rb#L442-L442>

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:

> <https://github.com/discourse/discourse/blob/35a866fe229ffe6a22b947a671c82c1bcc7dec51/app/controllers/groups_controller.rb#L339-L344>

So we should change this:

1. Add a unique index on `group_requests(group_id, user_id)` so only one request can be in-flight

2. Remove the rate limit it makes no sense

3. If someone (via api) requests membership to a group and they already have a request in flight, an error should be returned

4. If someone (via api) requests membership they are already a member of, an error should be returned

5. 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?

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [17 april 2019 om 03:40 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188/5 "2019-04-17T03:40:15Z")

</div>

> [@sam](#):
>
> how to deal with repeat rejected group requests

we have a use case that fits the repeated requests and may be useful to others:

we ask people to send their proposals or answers to a specific challenge as a request when they want to apply to a specific group.

e.g. it’s a philosophy group, a philosophy question has been asked, and students should send their answers to the group if they want to join the group.

sometimes the question is an open problem, and we don’t want to limit them to only one suggestion! and those who can think diversely can join the group at the end.

* * *

so may it be the same as before, several application, but with a tune-able rate limit? e.g. **admins can put the limit empty, so that every one can only apply once to a group, or they can set it to time “t” so that everyone can apply every t seconds?**

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [17 april 2019 om 05:21 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188/6 "2019-04-17T05:21:39Z")

</div>

The new design introduces automatic rate limiting.

If you apply for group X, you can no longer apply for group X **until** the group manager decides if you are approved or denied.

The issue I was hinting at was

> What if there is a nasty user that keeps applying over and over and over to group X and getting rejected and so on.

I think for now I am comfortable leaving this to admins. If someone is being such a pain, raise with mods / admins and just ban the account.

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [25 april 2019 om 12:37 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188/7 "2019-04-25T12:37:41Z")

</div>

This has been fixed by:

[https://github.com/discourse/discourse/pull/7399](https://github.com/discourse/discourse/pull/7399)

---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [25 april 2019 om 12:39 UTC](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188/8 "2019-04-25T12:39:09Z")

</div>


