SkinTemplate: Improve remote content handling in content navigation URLs
Use Title::isKnown() to determine whether to display the "view" view link instead of checking $isForeignFile, since that includes all remote content. This allows us to remove the GlobalUserPage hook that made the tab look as if it existed. Change-Id: Ibee7b64511fba8c2934da3c7a3bdd52090dcb58c
This commit is contained in:
parent
148f7bf0d1
commit
67d589450e
1 changed files with 7 additions and 6 deletions
|
|
@ -909,11 +909,8 @@ class SkinTemplate extends Skin {
|
|||
$content_navigation['namespaces'][$talkId]['context'] = 'talk';
|
||||
|
||||
if ( $userCanRead ) {
|
||||
$isForeignFile = $title->inNamespace( NS_FILE ) && $this->canUseWikiPage() &&
|
||||
$this->getWikiPage() instanceof WikiFilePage && !$this->getWikiPage()->isLocal();
|
||||
|
||||
// Adds view view link
|
||||
if ( $title->exists() || $isForeignFile ) {
|
||||
// Adds "view" view link
|
||||
if ( $title->isKnown() ) {
|
||||
$content_navigation['views']['view'] = $this->tabAction(
|
||||
$isTalk ? $talkPage : $subjectPage,
|
||||
[ "$skname-view-view", 'view' ],
|
||||
|
|
@ -923,7 +920,11 @@ class SkinTemplate extends Skin {
|
|||
$content_navigation['views']['view']['redundant'] = true;
|
||||
}
|
||||
|
||||
$isForeignFile = $title->inNamespace( NS_FILE ) && $this->canUseWikiPage() &&
|
||||
$this->getWikiPage() instanceof WikiFilePage && !$this->getWikiPage()->isLocal();
|
||||
|
||||
// If it is a non-local file, show a link to the file in its own repository
|
||||
// @todo abstract this for remote content that isn't a file
|
||||
if ( $isForeignFile ) {
|
||||
$file = $this->getWikiPage()->getFile();
|
||||
$content_navigation['views']['view-foreign'] = [
|
||||
|
|
@ -981,7 +982,7 @@ class SkinTemplate extends Skin {
|
|||
'href' => $title->getLocalURL( 'action=edit§ion=new' )
|
||||
];
|
||||
}
|
||||
// Checks if the page has some kind of viewable content
|
||||
// Checks if the page has some kind of viewable source content
|
||||
} elseif ( $title->hasSourceText() ) {
|
||||
// Adds view source view link
|
||||
$content_navigation['views']['viewsource'] = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue