Merge "Show edit and history links even if page is protected"

This commit is contained in:
jenkins-bot 2017-11-25 13:56:52 +00:00 committed by Gerrit Code Review
commit 44aa608aae
3 changed files with 5 additions and 4 deletions

View file

@ -51,6 +51,7 @@
"linter-numerrors": "($1 {{PLURAL:$1|error|errors}})",
"linker-page-title-edit": "$1 ($2)",
"linker-page-edit": "edit",
"linter-page-viewsource": "view source",
"linker-page-history": "history",
"linter-heading-high-priority": "High priority",
"linter-heading-medium-priority": "Medium priority",

View file

@ -55,6 +55,7 @@
"linter-numerrors": "Shown after a category link to indicate how many errors are in that category. $1 is the number of errors, and can be used for PLURAL.\n{{Identical|Error}}",
"linker-page-title-edit": "Used in a table cell. $1 is a link to the page, $2 is pipe separated links to the edit and history pages, the link text is {{msg-mw|linker-page-edit}} and {{msg-mw|linker-page-history}}",
"linker-page-edit": "Link text for edit link in {{msg-mw|linker-page-title-edit}}\n{{Identical|Edit}}",
"linter-page-viewsource": "Link text for view source link when user does not have permission to edit in {{msg-mw|linker-page-title-edit}}",
"linker-page-history": "Link text for history link in {{msg-mw|linker-page-title-edit}}\n{{Identical|History}}",
"linter-heading-high-priority": "Heading on [[Special:LintErrors]]",
"linter-heading-medium-priority": "Heading on [[Special:LintErrors]]",

View file

@ -116,12 +116,11 @@ class LintErrorsPager extends TablePager {
case 'title':
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
$viewLink = $this->linkRenderer->makeLink( $title );
if ( !$title->quickUserCan( 'edit', $this->getUser() ) ) {
return $viewLink;
}
$editMsgKey = $title->quickUserCan( 'edit', $this->getUser() ) ?
'linker-page-edit' : 'linter-page-viewsource';
$editLink = $this->linkRenderer->makeLink(
$title,
$this->msg( 'linker-page-edit' )->text(),
$this->msg( $editMsgKey )->text(),
[],
[ 'action' => $editAction, 'lintid' => $lintError->lintId, ]
);