Diff
Modified: branches/invitation_throttling/app/models/activity_limit.rb (2020 => 2021)
--- branches/invitation_throttling/app/models/activity_limit.rb 2008-11-30 15:08:20 UTC (rev 2020)
+++ branches/invitation_throttling/app/models/activity_limit.rb 2008-12-01 16:08:00 UTC (rev 2021)
@@ -93,11 +93,12 @@
end
- # returns the remaining allowance for the limited feature; NIL if unlimited or limit doesn't exist
+ # returns the remaining allowance (and the date/time when it finishes) for the limited feature;
+ # [NIL, NIL] if unlimited or limit doesn't exist
def self.remaining_allowance(contributor, limit_feature)
limit = ActivityLimit.find(:first, :conditions => ["contributor_type = ? AND contributor_id = ? AND limit_feature = ?", contributor.class.name, contributor.id, limit_feature])
- return nil unless limit
- return (limit.limit_max ? (limit.limit_max - limit.current_count) : nil)
+ return [nil, nil] unless limit
+ return [(limit.limit_max ? (limit.limit_max - limit.current_count) : nil), limit.reset_after]
end
end
Modified: branches/invitation_throttling/app/views/networks/invite.rhtml (2020 => 2021)
--- branches/invitation_throttling/app/views/networks/invite.rhtml 2008-11-30 15:08:20 UTC (rev 2020)
+++ branches/invitation_throttling/app/views/networks/invite.rhtml 2008-12-01 16:08:00 UTC (rev 2021)
@@ -53,8 +53,8 @@
<table>
<tr>
<td style="text-align: left;">
- <% remaining_allowance = ActivityLimit.remaining_allowance(current_user, "group_invite") -%>
- <%= info_icon_with_tooltip("To include several email addresses, use commas or semicolons to separate them.<br/>#{remaining_allowance ? "Please note that your current allowance is to send invitations to #{remaining_allowance} unique, valid, non-blank address(es) in the list." : "Please note that limitations on the number of invitations to be sent may apply."}") %>
+ <% remaining_allowance, allowance_finishes = ActivityLimit.remaining_allowance(current_user, "group_invite") -%>
+ <%= info_icon_with_tooltip("To include several email addresses, use commas or semicolons to separate them.<br/>#{remaining_allowance ? "Please note that your current allowance is to send invitations to #{remaining_allowance} unique, valid, non-blank address(es) in the list; the allowance #{allowance_finishes ? "will be renewed after #{allowance_finishes.strftime("%H:%M on %d/%m/%Y")}" : "will not be reset"}." : "Please note that limitations on the number of invitations to be sent may apply."}") %>
Email address(es) to send invitations to:<br/>
<% email_addresses_val = ((params[:invitations].nil? || params[:invitations][:address_list].nil?) ? "" : params[:invitations][:address_list]) %>
<%= text_field_tag "invitations[address_list]", email_addresses_val, :style => "width: 500px; margin-bottom: 0.8em;" -%><br/>
Modified: branches/invitation_throttling/app/views/users/_invite.rhtml (2020 => 2021)
--- branches/invitation_throttling/app/views/users/_invite.rhtml 2008-11-30 15:08:20 UTC (rev 2020)
+++ branches/invitation_throttling/app/views/users/_invite.rhtml 2008-12-01 16:08:00 UTC (rev 2021)
@@ -8,8 +8,8 @@
<p style="line-heght: 1.5; margin-left: 1.5em">
<%= hidden_field_tag :invitations_user_id, current.id -%>
- <% remaining_allowance = ActivityLimit.remaining_allowance(current_user, "user_invite") -%>
- <%= info_icon_with_tooltip("To include several email addresses, use commas or semicolons to separate them.<br/>#{remaining_allowance ? "Please note that your current allowance is to send invitations to #{remaining_allowance} unique, valid, non-blank address(es) in the list." : "Please note that limitations on the number of invitations to be sent may apply."}") %>
+ <% remaining_allowance, allowance_finishes = ActivityLimit.remaining_allowance(current_user, "user_invite") -%>
+ <%= info_icon_with_tooltip("To include several email addresses, use commas or semicolons to separate them.<br/>#{remaining_allowance ? "Please note that your current allowance is to send invitations to #{remaining_allowance} unique, valid, non-blank address(es) in the list; the allowance #{allowance_finishes ? "will be renewed after #{allowance_finishes.strftime("%H:%M on %d/%m/%Y")}" : "will not be reset"}." : "Please note that limitations on the number of invitations to be sent may apply."}") %>
Email addresses to send invitations to:<br/>
<% email_addresses_val = ((params[:invitations].nil? || params[:invitations][:addr_to].nil?) ? "" : params[:invitations][:addr_to]) %>
<%= text_field_tag "invitations[addr_to]", email_addresses_val, :style => "width: 500px; margin-bottom: 0.5em;" -%><br/>