Modified: branches/invitation_throttling/app/controllers/application.rb (2012 => 2013)
--- branches/invitation_throttling/app/controllers/application.rb 2008-11-28 14:19:13 UTC (rev 2012)
+++ branches/invitation_throttling/app/controllers/application.rb 2008-11-28 15:46:16 UTC (rev 2013)
@@ -116,14 +116,14 @@
action_allowed = false if (limit.current_count >= limit.limit_max)
end
- # update counted for the "current" action
+ # update counter for the "current" action
if action_allowed && update_counter
limit.current_count += 1
end
limit.save # saves all changes (including counter resets, etc)
-
- return [action_allowed, (limit.reset_after - time_now)]
+ # return if action is allowed / denied and when the next reset is going to be (nil for non-periodic counters)
+ return [action_allowed, (limit.reset_after ? (limit.reset_after - time_now) : nil)]
end
Modified: branches/invitation_throttling/app/controllers/messages_controller.rb (2012 => 2013)
--- branches/invitation_throttling/app/controllers/messages_controller.rb 2008-11-28 14:19:13 UTC (rev 2012)
+++ branches/invitation_throttling/app/controllers/messages_controller.rb 2008-11-28 15:46:16 UTC (rev 2013)
@@ -97,8 +97,10 @@
else
# no more messages can be sent because of the activity limit
respond_to do |format|
- error_msg = "You have reached the message limit, "
- if allowed_plus_timespan[1] <= 60
+ error_msg = "You can't send messages - your limit is reached, "
+ if allowed_plus_timespan[1].nil?
+ error_msg += "it will not be reset. Please contact myExperiment administration for details."
+ elsif allowed_plus_timespan[1] <= 60
error_msg += "please try again within a couple of minutes"
else
error_msg += "it will be reset in " + formatted_timespan(allowed_plus_timespan[1])