Don't throw away user's text when rate limit is exceeded

When a page save fails due to a rate limit being exceeded, show an error
message and the edit form with the submitted text, instead of throwing
away the submitted text.

Most error display in EditPage is done in showHeader(), hence the lack
of examples to follow here in handleStatus(). PermissionsError has a
bunch of useful logic so is not easily replaced, and permissions errors
may also be shown before save. ReadOnlyError handling is duplicated in
edit() and showHeader() so the exception here is usually not thrown.

Change-Id: I7cb268fb6e20888cddef73d0ee9b0bf060ccafda
This commit is contained in:
Tim Starling 2022-07-12 12:15:12 +10:00
parent e6e35021d4
commit 93a51c3337

View file

@ -2023,7 +2023,10 @@ class EditPage implements IEditObject {
throw new ReadOnlyError;
case self::AS_RATE_LIMITED:
throw new ThrottledError();
$out->wrapWikiTextAsInterface( 'error',
wfMessage( 'actionthrottledtext' )->plain()
);
return true;
case self::AS_NO_CREATE_PERMISSION:
$permission = $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage';