Bsitu has uploaded a new change for review.
https://gerrit.wikimedia.org/r/92678
Change subject: Replying to reply sends notification to the wrong target
......................................................................
Replying to reply sends notification to the wrong target
bug: 56224
Change-Id: Ife8c17b5f6ab96c0d78ffa46466b28b736e59e4b
---
M modules/discussion/forms.js
M modules/discussion/ui.js
2 files changed, 18 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/78/92678/1
diff --git a/modules/discussion/forms.js b/modules/discussion/forms.js
index 2ee3544..d463e5d 100644
--- a/modules/discussion/forms.js
+++ b/modules/discussion/forms.js
@@ -56,9 +56,7 @@
function() {
var $form = $( this ).closest( '.flow-reply-form' ),
workflowId = $( this ).flow(
'getTopicWorkflowId' ),
- replyToId = $( this )
- .closest( '.flow-post-container' )
- .data( 'post-id' ),
+ replyToId = $form.find(
'input[name="topic[replyTo]"]' ).val(),
content = mw.flow.editor.getContent(
$form.find( '.flow-reply-content' ) );
return [ workflowId, replyToId, content ];
diff --git a/modules/discussion/ui.js b/modules/discussion/ui.js
index 87efc57..cbc3fe5 100644
--- a/modules/discussion/ui.js
+++ b/modules/discussion/ui.js
@@ -50,9 +50,25 @@
var $form,
$viewport = $('main, html');
+ /**
+ * Internal helper function for adjusting the
ReplyTo target
+ * @param $btn the reply button jquery object
+ * @param $targetFrom the form juqery object to
submit post reply
+ */
+ function adjustReplyTarget( $btn, $targetForm )
{
+ var replyTo = $btn.closest(
'.flow-post' ).attr( 'data-post-id' );
+ var replyDefaultText = $btn.closest(
'.flow-post' )
+ .siblings(
'form.flow-reply-form' )
+ .find( 'textarea' )
+ .attr( 'placeholder' );
+ $targetForm.find(
'input[name="topic[replyTo]"]' ).val( replyTo );
+ $targetForm.find( 'textarea' ).val(
replyDefaultText );
+ }
+
if ( $(this).is( '.flow-post-container
.flow-post-container *' ) ) {
// We're in a tangent
$form = $( this ).closest(
'.flow-post-replies' ).siblings( 'form.flow-reply-form' );
+ adjustReplyTarget( $( this ), $form );
$( this ).closest(
'.flow-topic-container' ).find( '.flow-topic-reply-container' ).hide();
} else if ( $(this).is( '.flow-topic-comments
.flow-reply-link' ) ) {
// We're in the topic title
@@ -60,6 +76,7 @@
} else {
// Not in a tangent
$form = $( this ).closest( '.flow-post'
).siblings( 'form.flow-reply-form' );
+ adjustReplyTarget( $( this ), $form );
}
$textarea = $form.find( 'textarea' );
--
To view, visit https://gerrit.wikimedia.org/r/92678
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife8c17b5f6ab96c0d78ffa46466b28b736e59e4b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits