# كم مرة يمكن للمرء التقدم إلى مجموعة؟

**URL:** <https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188>\
**Category:** Bug\
**Created:** [16 أبريل 2019، 8: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:** 1\
**Showing post:** 3

<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 أبريل 2019، 1: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?

---

_[View the full topic](https://meta.discourse.org/t/how-many-times-can-one-apply-to-a-group/115188)._
