Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243<?php
final class PhabricatorRateLimitRequestExceptionHandler extends PhabricatorRequestExceptionHandler {
public function getRequestExceptionHandlerPriority() { return 300000; }
public function getRequestExceptionHandlerDescription() { return pht( 'Handles action rate limiting exceptions which occur when a user '. 'does something too frequently.'); }
public function canHandleRequestThrowable( AphrontRequest $request, $throwable) {
if (!$this->isPhabricatorSite($request)) { return false; }
return ($throwable instanceof PhabricatorSystemActionRateLimitException); }
public function handleRequestThrowable( AphrontRequest $request, $throwable) {
$viewer = $this->getViewer($request);
return id(new AphrontDialogView()) ->setTitle(pht('Slow Down!')) ->setUser($viewer) ->setErrors(array(pht('You are being rate limited.'))) ->appendParagraph($throwable->getMessage()) ->appendParagraph($throwable->getRateExplanation()) ->addCancelButton('/', pht('Okaaaaaaaaaaaaaay...')); }
}