mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Show last protection log entry and link to full protection log on protection notice"
This commit is contained in:
commit
ba59cc567f
|
@ -330,16 +330,6 @@ class ApiVisualEditor extends ApiBase {
|
|||
if ( $parsed && $parsed['restoring'] ) {
|
||||
$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
|
||||
if ( !$page->exists() ) {
|
||||
$wgVisualEditorEditNotices[] = $user->isLoggedIn() ? 'newarticletext' : 'newarticletextanon';
|
||||
|
@ -353,6 +343,33 @@ class ApiVisualEditor extends ApiBase {
|
|||
$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
|
||||
$article = new Article( $page ); // Deliberately omitting ,0 so oldid comes from request
|
||||
|
|
Loading…
Reference in a new issue