* (bug 36641) Patrol page links no longer show on non-existent revisions.
* (bug 35810) Pages not linked from Special:RecentChanges or Special:NewPages
are patrollable now.
+* (bug 30213) JavaScript for search suggestions is now disabled when the API
+ is disabled, and AJAX patrolling and watching are now disabled when use of
+ the write API is not allowed.
=== API changes in 1.22 ===
* (bug 46626) xmldoublequote parameter was removed. Because of a bug, the
* OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.
*/
public function showPatrolFooter() {
- global $wgUseRCPatrol, $wgUseNPPatrol, $wgRCMaxAge;
+ global $wgUseRCPatrol, $wgUseNPPatrol, $wgRCMaxAge, $wgEnableAPI, $wgEnableWriteAPI;
$request = $this->getContext()->getRequest();
$outputPage = $this->getContext()->getOutput();
$token = $user->getEditToken( $rcid );
$outputPage->preventClickjacking();
- $outputPage->addModules( 'mediawiki.page.patrol.ajax' );
+ if ( $wgEnableAPI && $wgEnableWriteAPI && $user->isAllowed( 'writeapi' ) ) {
+ $outputPage->addModules( 'mediawiki.page.patrol.ajax' );
+ }
$link = Linker::linkKnown(
$this->getTitle(),
*/
public function getDefaultModules() {
global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax,
- $wgAjaxWatch;
+ $wgAjaxWatch, $wgEnableAPI, $wgEnableWriteAPI;
$out = $this->getOutput();
$user = $out->getUser();
if ( $wgUseAjax ) {
$modules['legacy'][] = 'mediawiki.legacy.ajax';
- if ( $wgAjaxWatch && $user->isLoggedIn() ) {
- $modules['watch'][] = 'mediawiki.page.watch.ajax';
- }
+ if ( $wgEnableAPI ) {
+ if ( $wgEnableWriteAPI && $wgAjaxWatch && $user->isLoggedIn()
+ && $user->isAllowed( 'writeapi' )
+ ) {
+ $modules['watch'][] = 'mediawiki.page.watch.ajax';
+ }
- if ( !$user->getOption( 'disablesuggest', false ) ) {
- $modules['search'][] = 'mediawiki.searchSuggest';
+ if ( !$user->getOption( 'disablesuggest', false ) ) {
+ $modules['search'][] = 'mediawiki.searchSuggest';
+ }
}
}
* @return String
*/
protected function markPatrolledLink() {
- global $wgUseRCPatrol, $wgRCMaxAge;
+ global $wgUseRCPatrol, $wgRCMaxAge, $wgEnableAPI, $wgEnableWriteAPI;
$cache = wfGetMainCache();
if ( $this->mMarkPatrolledLink === null ) {
// Build the link
if ( $rcid ) {
$this->getOutput()->preventClickjacking();
- $this->getOutput()->addModules( 'mediawiki.page.patrol.ajax' );
+ if ( $wgEnableAPI && $wgEnableWriteAPI
+ && $this->getUser()->isAllowed( 'writeapi' )
+ ) {
+ $this->getOutput()->addModules( 'mediawiki.page.patrol.ajax' );
+ }
$token = $this->getUser()->getEditToken( $rcid );
$this->mMarkPatrolledLink = ' <span class="patrollink">[' . Linker::linkKnown(