EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/162174
Change subject: Repair individual post collapse in Topic namespace
......................................................................
Repair individual post collapse in Topic namespace
The code that disabled collapsing topics in the Topic namespace also
ended up stopping moderated posts from being collapsed. Adjust the
code so it only prevents collapsing the topic.
(cherry-pick from 7c023f7b4d74cedea5ce0de1c038494c1f8c9cd1)
Bug: 71132
Change-Id: I133bfaf0ed22bb1e8d3ba7b0b461ca8f0d5de389
---
M handlebars/compiled/flow_block_topic.handlebars.php
M handlebars/flow_block_topic.handlebars
M modules/new/components/flow-board.js
M modules/new/styles/board/collapser.less
4 files changed, 30 insertions(+), 17 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/74/162174/1
diff --git a/handlebars/compiled/flow_block_topic.handlebars.php
b/handlebars/compiled/flow_block_topic.handlebars.php
index a549144..37823c7 100644
--- a/handlebars/compiled/flow_block_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic.handlebars.php
@@ -30,7 +30,7 @@
'sp_vars' => Array(),
);
- return '<div class="flow-board flow-disable-collapse">
+ return '<div class="flow-board flow-disable-topic-collapse">
<div class="flow-topics">
'.'
'.LCRun3::sec($cx, ((is_array($in) && isset($in['roots'])) ?
$in['roots'] : null), $in, true, function($cx, $in) {return '
diff --git a/handlebars/flow_block_topic.handlebars
b/handlebars/flow_block_topic.handlebars
index 598acfe..84353d1 100644
--- a/handlebars/flow_block_topic.handlebars
+++ b/handlebars/flow_block_topic.handlebars
@@ -1,4 +1,4 @@
-<div class="flow-board flow-disable-collapse">
+<div class="flow-board flow-disable-topic-collapse">
<div class="flow-topics">
{{!-- There is only one topic, but we use same api response
structure --}}
{{> flow_topiclist_loop}}
diff --git a/modules/new/components/flow-board.js
b/modules/new/components/flow-board.js
index f44c60b..39735e9 100644
--- a/modules/new/components/flow-board.js
+++ b/modules/new/components/flow-board.js
@@ -4,7 +4,10 @@
( function ( $, mw ) {
var namespaces = mw.config.get( 'wgNamespaceIds' ),
- inTopicNamespace = mw.config.get( 'wgNamespaceNumber' ) ===
namespaces.topic;
+ inTopicNamespace = mw.config.get( 'wgNamespaceNumber' ) ===
namespaces.topic,
+ inTopicTitleInTopicNamespace = function ( $el ) {
+ return inTopicNamespace && $el.closest( '.flow-post'
).length === 0;
+ };
/**
* Constructor class for instantiating a new Flow board. Returns a
FlowBoardComponent object.
@@ -1152,6 +1155,11 @@
* @param {jQuery} $topic
*/
FlowBoardComponent.UI.events.loadHandlers.collapserState =
function ( $topic ) {
+ // Don't apply to titlebars in the topic namespace
+ if ( inTopicTitleInTopicNamespace( $( this ) ) ) {
+ return;
+ }
+
// Get last collapse state from sessionStorage
var stateForTopic, classForTopic,
states =
mw.flow.StorageEngine.sessionStorage.getItem( 'collapserStates' ) || {},
@@ -1312,6 +1320,11 @@
* @param {Event} event
*/
FlowBoardComponent.UI.events.interactiveHandlers.collapserGroupToggle =
function ( event ) {
+ // Don't apply to titlebars in the topic namespace
+ if ( inTopicTitleInTopicNamespace( $( this ) ) ) {
+ return;
+ }
+
var flowBoard =
FlowBoardComponent.prototype.getInstanceByElement( $( this ) );
FlowBoardComponent.UI.collapserState( flowBoard,
this.href.match( /[a-z]+$/ )[0] );
@@ -1330,6 +1343,11 @@
board =
FlowBoardComponent.prototype.getInstanceByElement( $this ),
isNotClickableElement = $target.not(
'.flow-menu-js-drop' ) &&
!$target.closest( 'a, button, input,
textarea, select, ul, ol' ).length;
+
+ // Don't apply to titlebars in the topic namespace
+ if ( inTopicTitleInTopicNamespace( $this ) ) {
+ return;
+ }
if ( isNotClickableElement ) {
$target = $( this ).closest( '.flow-post-main,
.flow-topic' ); // @todo genericize this
@@ -2386,13 +2404,6 @@
$topic.replaceWith( $newTopic );
FlowBoardComponent.UI.makeContentInteractive( $newTopic
);
- }
-
- if ( inTopicNamespace ) {
- // Topic pages do not have collapse states
-
FlowBoardComponent.UI.events.interactiveHandlers.collapserGroupToggle = $.noop;
-
FlowBoardComponent.UI.events.interactiveHandlers.collapserCollapsibleToggle =
$.noop;
- FlowBoardComponent.UI.collapserState = $.noop;
}
}() );
}( jQuery, mediaWiki ) );
diff --git a/modules/new/styles/board/collapser.less
b/modules/new/styles/board/collapser.less
index 57fc88e..a02cdbd 100644
--- a/modules/new/styles/board/collapser.less
+++ b/modules/new/styles/board/collapser.less
@@ -28,20 +28,22 @@
}
}
-.flow-board:not(.flow-disable-collapse) {
+.flow-board:not(.flow-disable-topic-collapse) {
div.flow-element-collapsed {
// topic hidden
.flow-post,
.flow-reply-form {
display: none;
}
+ }
+}
- // post hidden
- .flow-post & {
- .flow-post-content,
- .flow-post-meta {
- display: none;
- }
+.flow-post {
+ // post hidden
+ div.flow-element-collapsed {
+ .flow-post-content,
+ .flow-post-meta {
+ display: none;
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/162174
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I133bfaf0ed22bb1e8d3ba7b0b461ca8f0d5de389
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: wmf/1.24wmf22
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits