moved Dmails per-hour limit to config.

also fixed error that caused users to be able to send limit + 1 dmails.
This commit is contained in:
Parziphal 2013-12-02 17:29:26 -05:00
parent c75071b77c
commit 60e4a1229f
2 changed files with 5 additions and 2 deletions

View File

@ -28,8 +28,8 @@ class DmailController extends ApplicationController
public function create()
{
if (Dmail::where('from_id = ? AND created_at > ?', $this->current_user->id, date('Y-m-d H:i:s', time()-3600))->count() > 10) {
$this->notice("You can't send more than 10 dmails per hour.");
if (Dmail::where('from_id = ? AND created_at > ?', $this->current_user->id, date('Y-m-d H:i:s', time()-3600))->count() >= CONFIG()->max_dmails_per_hour) {
$this->notice("You can't send more than " . CONFIG()->max_dmails_per_hour . " dmails per hour.");
$this->redirectTo('#inbox');
return;
}

View File

@ -293,6 +293,9 @@ abstract class DefaultConfig
# Enables the E/R hotkeys to jump to the edit/reply forms respectevely in post#show.
public $post_show_hotkeys = true;
# Max number of dmails users can send in one hour.
public $max_dmails_per_hour = 10;
# Only Job tasks listed here will be active.
# @see $enable_asynchronous_tasks
# @see is_job_task_active()