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:
parent
c75071b77c
commit
60e4a1229f
@ -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;
|
||||
}
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user