jenkins-bot has submitted this change and it was merged.
Change subject: Fix the last modified bar regression for cached pages
......................................................................
Fix the last modified bar regression for cached pages
Also fix nested <a>s.
Bug: T100429
Change-Id: I227e1395ba1d3f45a6ff9f8acd79cc0703cb122c
(cherry picked from commit 02862a504d60569113669a8a50c4142c7141087a)
---
M includes/skins/history.mustache
M resources/mobile.head/init.js
2 files changed, 20 insertions(+), 12 deletions(-)
Approvals:
Kaldari: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/skins/history.mustache b/includes/skins/history.mustache
index 3f089bd..419d9cc 100644
--- a/includes/skins/history.mustache
+++ b/includes/skins/history.mustache
@@ -1,6 +1,6 @@
<div{{^isMainPage}} class="last-modified-bar"{{/isMainPage}}>
- <div id="mw-mf-last-modified">
- <a href="{{link}}" class="truncated-text"
+ <div id="mw-mf-last-modified" class="truncated-text">
+ <a href="{{link}}"
data-user-name="{{username}}"
data-user-gender="{{userGender}}"
data-timestamp="{{timestamp}}">
diff --git a/resources/mobile.head/init.js b/resources/mobile.head/init.js
index e263da5..89b185a 100644
--- a/resources/mobile.head/init.js
+++ b/resources/mobile.head/init.js
@@ -13,7 +13,12 @@
*/
function initHistoryLink() {
var $lastModified = $( '#mw-mf-last-modified' ),
- $lastModifiedLink = $lastModified.find( 'a' ),
+ // FIXME remove when the cache clears.
+ isPageCached = $lastModified.length &&
$lastModified.prop( 'tagName' ).toLowerCase() === 'a',
+ // FIXME remove the cache related part.
+ $lastModifiedLink = isPageCached ? $lastModified :
$lastModified.find( 'a' ),
+ // FIXME remove when the cache clears.
+ $lastModifiedBar = $( '.last-modified-bar' ),
historyUrl = $lastModifiedLink.attr( 'href' ),
ts = $lastModifiedLink.data( 'timestamp' ),
username = $lastModifiedLink.data( 'user-name' ) ||
false,
@@ -48,17 +53,20 @@
username ? mw.util.getUrl(
'Special:UserProfile/' + username ) : ''
] );
- $lastModifiedLink.html( mw.message.apply( this, args
).parse() );
-
- // FIXME: remove this when the cache clears. Today is
05/21/2015.
- // Make the cached DOM look similar to the new DOM
- if ( $lastModified.hasClass( 'last-modified-bar' ) ) {
- $lastModified
- .removeClass( 'last-modified-bar' )
- .wrap( '<div
class="last-modified-bar"></div>' );
+ // FIXME: remove the if part when the cache clears.
+ if ( isPageCached || $lastModifiedLink.hasClass(
'truncated-text' ) ) {
+ $lastModifiedBar.replaceWith(
+ $( '<div class="last-modified-bar">' )
+ .html(
+ $( '<div
id="mw-mf-last-modified" class="truncated-text">' )
+ .html(
mw.message.apply( this, args ).parse() )
+ )
+ );
+ } else {
+ $lastModifiedLink.replaceWith(
mw.message.apply( this, args ).parse() );
}
} else {
- // FIXME: remove this when the cache clears. Today is
05/21/2015.
+ // FIXME: remove this when the cache clears.
// Make the cached DOM look similar to the new DOM on
the Main_Page
// It's important that this runs when the DOM is ready,
otherwise it won't work
// in stable where the 'history-link-loaded' event is
fired before the DOM is ready.
--
To view, visit https://gerrit.wikimedia.org/r/215983
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I227e1395ba1d3f45a6ff9f8acd79cc0703cb122c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: wmf/1.26wmf8
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits