Henning Snater has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/74593


Change subject: Preventing template strings from getting parsed in Diff view 
headings
......................................................................

Preventing template strings from getting parsed in Diff view headings

Change-Id: I849adffc0c64e4ebdb03a348db3b95868001675e
---
M repo/includes/actions/HistoryEntityAction.php
M repo/includes/actions/ViewEntityAction.php
M repo/tests/selenium/item/revision_spec.rb
M selenium/lib/pages/history_page.rb
4 files changed, 11 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/93/74593/1

diff --git a/repo/includes/actions/HistoryEntityAction.php 
b/repo/includes/actions/HistoryEntityAction.php
index de38277..395e470 100644
--- a/repo/includes/actions/HistoryEntityAction.php
+++ b/repo/includes/actions/HistoryEntityAction.php
@@ -90,10 +90,12 @@
                $prefixedId = ucfirst( $idPrefixer->format( $entity->getId() ) 
);
 
                if ( isset( $labelText ) ) {
-                       return $this->msg( 'wikibase-history-title-with-label', 
$prefixedId, $labelText )->text();
+                       return $this->msg( 'wikibase-history-title-with-label' )
+                               ->rawParams( $prefixedId, $labelText )->text();
                }
                else {
-                       return $this->msg( 
'wikibase-history-title-without-label', $prefixedId )->text();
+                       return $this->msg( 
'wikibase-history-title-without-label' )
+                               ->rawParams( $prefixedId )->text();
                }
        }
 }
diff --git a/repo/includes/actions/ViewEntityAction.php 
b/repo/includes/actions/ViewEntityAction.php
index c4cf88e..790aee7 100644
--- a/repo/includes/actions/ViewEntityAction.php
+++ b/repo/includes/actions/ViewEntityAction.php
@@ -240,14 +240,13 @@
                if ( $this->getContext()->getRequest()->getCheck( 'diff' ) ) {
                        $out->setPageTitle(
                                $this->msg(
-                                       'difference-title',
+                                       'difference-title'
                                        // This should be something like the 
following,
                                        // $labelLang->getDirMark() . 
$labelText . $wgLang->getDirMark()
                                        // or should set the attribute of the 
h1 to correct direction.
                                        // Still note that the direction is 
"auto" so guessing should
                                        // give the right direction in most 
cases.
-                                       $labelText
-                               )
+                               )->rawParams( $labelText )
                        );
                } else {
                        // Prevent replacing {{...}} by using rawParams() 
instead of params():
diff --git a/repo/tests/selenium/item/revision_spec.rb 
b/repo/tests/selenium/item/revision_spec.rb
index d7dd2e5..c209135 100644
--- a/repo/tests/selenium/item/revision_spec.rb
+++ b/repo/tests/selenium/item/revision_spec.rb
@@ -10,6 +10,7 @@
 
 num_items = 1
 num_props_string = 1
+template_text = "{{Template:" + generate_random_string(10) + "}}"
 
 # items
 count = 0
@@ -47,6 +48,7 @@
     on_page(ItemPage) do |page|
       page.navigate_to items[0]["url"]
       page.wait_for_entity_to_load
+      page.change_label(template_text)
       page.change_description(generate_random_string(20))
       page.add_statement(properties_string[0]["label"], 
string_values[0]["value"])
     end
@@ -56,6 +58,7 @@
     it "should check there are no editbuttons" do
       on_page(HistoryPage) do |page|
         page.navigate_to_item_history
+        page.mwFirstHeading.include?(template_text).should === true
         page.oldrevision2
       end
       on_page(ItemPage) do |page|
diff --git a/selenium/lib/pages/history_page.rb 
b/selenium/lib/pages/history_page.rb
index 5a8346c..3bde2d4 100644
--- a/selenium/lib/pages/history_page.rb
+++ b/selenium/lib/pages/history_page.rb
@@ -9,6 +9,8 @@
 class HistoryPage
   include PageObject
 
+  h1(:mwFirstHeading, :id => "firstHeading")
+
   link(:historyLink, :xpath => "//li[@id='ca-history']/span/a")
   link(:rollbackLink, :css => "span.mw-rollback-link > a")
   link(:returnToItemLink, :css => "p#mw-returnto > a")

-- 
To view, visit https://gerrit.wikimedia.org/r/74593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I849adffc0c64e4ebdb03a348db3b95868001675e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to