Merge "Show last protection log entry and link to full protection log on protection notice"

This commit is contained in:
jenkins-bot 2014-03-18 17:33:40 +00:00 committed by Gerrit Code Review
commit ba59cc567f

View file

@ -330,16 +330,6 @@ class ApiVisualEditor extends ApiBase {
if ( $parsed && $parsed['restoring'] ) { if ( $parsed && $parsed['restoring'] ) {
$wgVisualEditorEditNotices[] = 'editingold'; $wgVisualEditorEditNotices[] = 'editingold';
} }
// Page protected from editing
if ( $page->getNamespace() != NS_MEDIAWIKI && $page->isProtected( 'edit' ) ) {
# Is the title semi-protected?
if ( $page->isSemiProtected() ) {
$wgVisualEditorEditNotices[] = 'semiprotectedpagewarning';
} else {
# Then it must be protected based on static groups (regular)
$wgVisualEditorEditNotices[] = 'protectedpagewarning';
}
}
// Creating new page // Creating new page
if ( !$page->exists() ) { if ( !$page->exists() ) {
$wgVisualEditorEditNotices[] = $user->isLoggedIn() ? 'newarticletext' : 'newarticletextanon'; $wgVisualEditorEditNotices[] = $user->isLoggedIn() ? 'newarticletext' : 'newarticletextanon';
@ -353,6 +343,33 @@ class ApiVisualEditor extends ApiBase {
$notices[] = wfMessage( $key )->parseAsBlock(); $notices[] = wfMessage( $key )->parseAsBlock();
} }
} }
// Page protected from editing
if ( $page->getNamespace() != NS_MEDIAWIKI && $page->isProtected( 'edit' ) ) {
# Is the title semi-protected?
if ( $page->isSemiProtected() ) {
$noticeMsg = 'semiprotectedpagewarning';
} else {
# Then it must be protected based on static groups (regular)
$noticeMsg = 'protectedpagewarning';
}
$lp = new LogPager(
new LogEventsList( $this->getContext() ),
'protect',
'',
$page->getPrefixedDBkey()
);
$lp->mLimit = 1;
$notices[] = wfMessage( $noticeMsg )->parseAsBlock() . $lp->getBody() . Linker::link(
SpecialPage::getTitleFor( 'Log' ),
$this->msg( 'log-fulllog' )->escaped(),
array(),
array(
'page' => $page->getPrefixedDBkey(),
'type' => 'protect'
)
);
}
// HACK: Build a fake EditPage so we can get checkboxes from it // HACK: Build a fake EditPage so we can get checkboxes from it
$article = new Article( $page ); // Deliberately omitting ,0 so oldid comes from request $article = new Article( $page ); // Deliberately omitting ,0 so oldid comes from request