Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/180060
Change subject: Show an error if ViewEntityAction is used with non-Entity
content
......................................................................
Show an error if ViewEntityAction is used with non-Entity content
ViewEntityAction is being called with non-Entity content eg. if a
user tries to diff wikitext content with entity content.
Bug: T73546
Change-Id: I1a5781e017df645b51b3ecdb016cd6cbd2c3d557
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/actions/ViewEntityAction.php
3 files changed, 17 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/60/180060/1
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 2e66cd4..793c44a 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -418,5 +418,7 @@
"right-item-merge": "Merge items",
"right-item-redirect": "Create item redirects",
"right-property-term": "Change property terms (labels, descriptions,
aliases)",
- "right-property-create": "Create properties"
+ "right-property-create": "Create properties",
+ "wikibase-entity-not-viewable-title": "Content type mismatch: Can not
display content",
+ "wikibase-entity-not-viewable": "The given content of type \"$1\" is
not an Entity and can not be displayed by Wikibase."
}
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index 900a90c..b0feaef 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -445,5 +445,7 @@
"right-item-merge": "{{doc-right|item-merge}}\nRight to alter the
contents of
[[d:Special:MyLanguage/Wikidata:Glossary#Item|items]].\n{{Identical|Merge
item}}",
"right-item-redirect": "{{doc-right|item-redirect}}\nRight to create
[[d:Special:MyLanguage/Wikidata:Glossary#Item|item]] redirects after merging
items.",
"right-property-term": "{{doc-right|property-term}}\nRight to alter the
[[d:Wikidata:Glossary#Term|terms]] of [[d:Wikidata:Glossary#Item|items]].",
- "right-property-create": "{{doc-right|property-create}}\nRight to
create new [[d:Wikidata:Glossary#Property|properties]]."
+ "right-property-create": "{{doc-right|property-create}}\nRight to
create new [[d:Wikidata:Glossary#Property|properties]].",
+ "wikibase-entity-not-viewable-title": "Page title on the error page
saying that content can't be displayed.",
+ "wikibase-entity-not-viewable": "Error message saying that some
content can't be rendered. $1 is the content model of the content that can't be
displayed (eg. wikitext)."
}
diff --git a/repo/includes/actions/ViewEntityAction.php
b/repo/includes/actions/ViewEntityAction.php
index 6298ef2..a747a01 100644
--- a/repo/includes/actions/ViewEntityAction.php
+++ b/repo/includes/actions/ViewEntityAction.php
@@ -95,6 +95,15 @@
$this->getArticle()
);
+ if ( !( $content instanceof EntityContent ) ) {
+ $this->getOutput()->showErrorPage(
+
'wikibase-entity-not-viewable-title',
+ 'wikibase-entity-not-viewable',
+ $content->getModel()
+ );
+ return;
+ }
+
$this->displayEntityContent( $content );
}
}
@@ -123,8 +132,9 @@
*
* @param EntityContent $content
*/
- protected function displayEntityContent( EntityContent $content ) {
+ private function displayEntityContent( EntityContent $content ) {
$outputPage = $this->getOutput();
+
$editable = $this->isEditable();
// NOTE: page-wide property, independent of user permissions
--
To view, visit https://gerrit.wikimedia.org/r/180060
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a5781e017df645b51b3ecdb016cd6cbd2c3d557
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: wmf/1.25wmf12c
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits