jenkins-bot has submitted this change and it was merged.
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.
Bug: 71132
Change-Id: I133bfaf0ed22bb1e8d3ba7b0b461ca8f0d5de389
---
M handlebars/compiled/flow_block_topic.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
M handlebars/flow_block_topic.handlebars
M modules/new/components/flow-board.js
M modules/new/styles/board/collapser.less
6 files changed, 40 insertions(+), 23 deletions(-)
Approvals:
SG: Looks good to me, approved
jenkins-bot: Verified
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/compiled/flow_block_topic_moderate_post.handlebars.php
b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
index 23cd539..a1a1de6 100644
--- a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
@@ -50,11 +50,16 @@
<input type="hidden" name="wpEditToken"
value="'.htmlentities(((is_array($cx['scopes'][0]) &&
isset($cx['scopes'][0]['editToken'])) ? $cx['scopes'][0]['editToken'] : null),
ENT_QUOTES, 'UTF-8').'" />
<textarea name="topic_reason"
+ required
+ data-flow-expandable="true"
+ class="mw-ui-input"
+ data-role="content"
placeholder="'.LCRun3::ch($cx, 'l10n',
Array(Array(LCRun3::ch($cx, 'concat',
Array(Array('flow-moderation-placeholder-',((is_array($cx['scopes'][0]['submitted'])
&& isset($cx['scopes'][0]['submitted']['moderationState'])) ?
$cx['scopes'][0]['submitted']['moderationState'] : null),'-post'),Array()),
'raw')),Array()), 'encq').'">'.((LCRun3::ifvar($cx,
((is_array($cx['scopes'][0]['submitted']) &&
isset($cx['scopes'][0]['submitted']['reason'])) ?
$cx['scopes'][0]['submitted']['reason'] : null))) ?
''.htmlentities(((is_array($cx['scopes'][0]['submitted']) &&
isset($cx['scopes'][0]['submitted']['reason'])) ?
$cx['scopes'][0]['submitted']['reason'] : null), ENT_QUOTES, 'UTF-8').'' :
'').'</textarea>
<div class="flow-form-actions flow-form-collapsible">
<button data-flow-interactive-handler="apiRequest"
data-flow-api-handler="moderatePost"
- class="mw-ui-button
mw-ui-constructive">'.LCRun3::ch($cx, 'l10n', Array(Array(LCRun3::ch($cx,
'concat',
Array(Array('flow-moderation-confirm-',((is_array($cx['scopes'][0]['submitted'])
&& isset($cx['scopes'][0]['submitted']['moderationState'])) ?
$cx['scopes'][0]['submitted']['moderationState'] : null),'-post'),Array()),
'raw')),Array()), 'encq').'</button>
+ class="mw-ui-button mw-ui-constructive"
+ data-role="submit">'.LCRun3::ch($cx, 'l10n',
Array(Array(LCRun3::ch($cx, 'concat',
Array(Array('flow-moderation-confirm-',((is_array($cx['scopes'][0]['submitted'])
&& isset($cx['scopes'][0]['submitted']['moderationState'])) ?
$cx['scopes'][0]['submitted']['moderationState'] : null),'-post'),Array()),
'raw')),Array()), 'encq').'</button>
<a data-flow-interactive-handler="cancelForm"
class="mw-ui-button mw-ui-destructive mw-ui-quiet"
href="'.htmlentities(((is_array($in['links']['topic']) &&
isset($in['links']['topic']['url'])) ? $in['links']['topic']['url'] : null),
ENT_QUOTES, 'UTF-8').'"
diff --git a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
index 19553cc..ee15105 100644
--- a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
@@ -51,16 +51,15 @@
<input type="hidden" name="wpEditToken"
value="'.htmlentities(((is_array($cx['scopes'][0]) &&
isset($cx['scopes'][0]['editToken'])) ? $cx['scopes'][0]['editToken'] : null),
ENT_QUOTES, 'UTF-8').'" />
<textarea name="topic_reason"
required
- data-flow-preview-template="flow_post"
data-flow-expandable="true"
class="mw-ui-input"
- type="text"
data-role="content"
placeholder="'.LCRun3::ch($cx, 'l10n',
Array(Array(LCRun3::ch($cx, 'concat',
Array(Array('flow-moderation-placeholder-',((is_array($cx['scopes'][0]['submitted'])
&& isset($cx['scopes'][0]['submitted']['moderationState'])) ?
$cx['scopes'][0]['submitted']['moderationState'] : null),'-topic'),Array()),
'raw')),Array()), 'encq').'">'.((LCRun3::ifvar($cx,
((is_array($cx['scopes'][0]['submitted']) &&
isset($cx['scopes'][0]['submitted']['reason'])) ?
$cx['scopes'][0]['submitted']['reason'] : null))) ?
''.htmlentities(((is_array($cx['scopes'][0]['submitted']) &&
isset($cx['scopes'][0]['submitted']['reason'])) ?
$cx['scopes'][0]['submitted']['reason'] : null), ENT_QUOTES, 'UTF-8').'' :
'').'</textarea>
<div class="flow-form-actions flow-form-collapsible">
<button class="mw-ui-button mw-ui-constructive"
- data-flow-interactive-handler="apiRequest"
-
data-flow-api-handler="moderateTopic">'.LCRun3::ch($cx, 'l10n',
Array(Array(LCRun3::ch($cx, 'concat',
Array(Array('flow-moderation-confirm-',((is_array($cx['scopes'][0]['submitted'])
&& isset($cx['scopes'][0]['submitted']['moderationState'])) ?
$cx['scopes'][0]['submitted']['moderationState'] : null),'-topic'),Array()),
'raw')),Array()), 'encq').'</button>
+ data-flow-interactive-handler="apiRequest"
+ data-flow-api-handler="moderateTopic"
+ data-role="submit">'.LCRun3::ch($cx, 'l10n',
Array(Array(LCRun3::ch($cx, 'concat',
Array(Array('flow-moderation-confirm-',((is_array($cx['scopes'][0]['submitted'])
&& isset($cx['scopes'][0]['submitted']['moderationState'])) ?
$cx['scopes'][0]['submitted']['moderationState'] : null),'-topic'),Array()),
'raw')),Array()), 'encq').'</button>
<a class="mw-ui-button mw-ui-quiet mw-ui-destructive"
href="'.htmlentities(((is_array($in['links']['topic']) &&
isset($in['links']['topic']['url'])) ? $in['links']['topic']['url'] : null),
ENT_QUOTES, 'UTF-8').'"
title="'.LCRun3::ch($cx, 'l10n',
Array(Array('flow-cancel'),Array()), 'encq').'"
@@ -626,4 +625,4 @@
</div>
';
}
-?>
+?>
\ No newline at end of file
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 5e336e5..741d907 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.
@@ -1144,6 +1147,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' ) || {},
@@ -1305,6 +1313,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] );
@@ -1323,6 +1336,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
@@ -2391,13 +2409,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;
}
/**
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/162126
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I133bfaf0ed22bb1e8d3ba7b0b461ca8f0d5de389
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: Spage <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits