new option - config.invitation_limit_for #201

matzke opened this Issue Apr 13, 2012 · 3 comments

3 participants


It would be nice, if there was an option +invitation_limit_for+ =, so the user can send only X invitations per day.

I think it is important to limit the number of invitations, so nobody can spam people. But it is also important to make it possible (for power users) to invite a whole bunch of people.


Do you have some ideas about implementation?


Maybe have something like an invitation_reload_period key, an invitation_last_sent_on, and a invitations_for_period key.

So invitation_reload_period would store the amount of time between invite refills. invitation_last_sent_on stores the time the user last sent an invitation. And invitations_for_period would store the number of invitations remaining in that period.

When a new invitation is created, we check whether there are still any invitations_for_period. If so, proceed as normal and decrement invitations_for_period.

If not, check to see if - invitation_last_sent_on >= invitation_reload_period. When false, we can't send the invitation, otherwise we refill the invitations_for_period from invitation_limit and decrement.

I realise now that I've typed this, the issue with this approach is that it hinges on the invitation-create action. I was trying to come up with a solution that wouldn't involve a cron job, but now I'm not sure that's possible.

Actually, we can also do the refilling (from paragraph 4) any time we want to get the invitation count, so that the count wouldn't show 0 invitations remaining even when we're past the invitation reload period.


invitations_for_period is not needed, invitation_limit can be used, class.invitation_limit would be the reset value
time check could be done in has_invitations

@scambra scambra was assigned Nov 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment