Amire80 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/98368
Change subject: Better GENDER support in moderation.js
......................................................................
Better GENDER support in moderation.js
* Add full message keys.
* Add GENDER support for the current user.
Change-Id: Ic6a86a84396a8f27cf4ae07f4028e3309afce308
---
M Flow.i18n.php
M Resources.php
M modules/moderation/moderation.js
3 files changed, 88 insertions(+), 40 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/68/98368/1
diff --git a/Flow.i18n.php b/Flow.i18n.php
index 98edf87..3f693e4 100644
--- a/Flow.i18n.php
+++ b/Flow.i18n.php
@@ -179,11 +179,11 @@
'flow-moderation-title-suppress-post' => 'Suppress post?',
'flow-moderation-title-delete-post' => 'Delete post?',
'flow-moderation-title-hide-post' => 'Hide post?',
- 'flow-moderation-title-restore-post'=> 'Restore post?',
- 'flow-moderation-intro-suppress-post' => "Please explain why you're
suppressing this post.",
- 'flow-moderation-intro-delete-post' => "Please explain why you're
deleting this post.",
- 'flow-moderation-intro-hide-post' => "Please explain why you're hiding
this post.",
- 'flow-moderation-intro-restore-post'=> "Please explain why you're
restoring this post.",
+ 'flow-moderation-title-restore-post' => 'Restore post?',
+ 'flow-moderation-intro-suppress-post' => "Please {{GENDER:$3|explain}}
why you're suppressing {{GENDER:$1|this}} post.",
+ 'flow-moderation-intro-delete-post' => "Please {{GENDER:$3|explain}}
why you're deleting {{GENDER:$1|this}} post.",
+ 'flow-moderation-intro-hide-post' => "Please {{GENDER:$3|explain}} why
you're hiding {{GENDER:$1|this}} post.",
+ 'flow-moderation-intro-restore-post' => "Please {{GENDER:$3|explain}}
why you're restoring {{GENDER:$1|this}} post.",
'flow-moderation-confirm-suppress-post' => 'Suppress',
'flow-moderation-confirm-delete-post' => 'Delete',
'flow-moderation-confirm-hide-post' => 'Hide',
@@ -195,11 +195,11 @@
'flow-moderation-title-suppress-topic' => 'Suppress topic?',
'flow-moderation-title-delete-topic' => 'Delete topic?',
'flow-moderation-title-hide-topic' => 'Hide topic?',
- 'flow-moderation-title-restore-topic'=> 'Restore topic?',
- 'flow-moderation-intro-suppress-topic' => "Please explain why you're
suppressing this topic.",
- 'flow-moderation-intro-delete-topic' => "Please explain why you're
deleting this topic.",
- 'flow-moderation-intro-hide-topic' => "Please explain why you're hiding
this topic.",
- 'flow-moderation-intro-restore-topic'=> "Please explain why you're
restoring this topic.",
+ 'flow-moderation-title-restore-topic' => 'Restore topic?',
+ 'flow-moderation-intro-suppress-topic' => "Please {{GENDER:$3|explain}}
why you're suppressing {{GENDER:$1|this}} topic.",
+ 'flow-moderation-intro-delete-topic' => "Please {{GENDER:$3|explain}}
why you're deleting {{GENDER:$1|this}} topic.",
+ 'flow-moderation-intro-hide-topic' => "Please {{GENDER:$3|explain}} why
you're hiding {{GENDER:$1|this}} topic.",
+ 'flow-moderation-intro-restore-topic' => "Please {{GENDER:$3|explain}}
why you're restoring {{GENDER:$1|this}} topic.",
'flow-moderation-confirm-suppress-topic' => 'Suppress',
'flow-moderation-confirm-delete-topic' => 'Delete',
'flow-moderation-confirm-hide-topic' => 'Hide',
@@ -765,20 +765,20 @@
{{Related|Flow-moderation-title}}
{{Identical|Restore post}}',
'flow-moderation-intro-suppress-post' => 'Intro for the moderation
confirmation dialog when a post is being suppressed. Parameters:
-* $1 - (Unused) the name of the user whose post is being suppressed. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a post is being suppressed
+* $1 - the user whose post is being moderated. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-intro-delete-post' => 'Intro for the moderation
confirmation dialog when a post is being deleted. Parameters:
-* $1 - (Unused) the name of the user whose post is being deleted. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a post is being deleted
+* $1 - the user whose post is being moderated. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-intro-hide-post' => 'Intro for the moderation
confirmation dialog when a post is being hidden. Parameters:
-* $1 - (Unused) the name of the user whose post is being hidden. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a post is being hidden
+* $1 - the user whose post is being moderated. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-intro-restore-post' => 'Intro for the restore
confirmation dialog. Parameters:
-* $1 - (Unused) the name of the user whose post is being suppressed. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a post is being suppressed
+* $1 - the user whose post is being moderated. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-confirm-suppress-post' => 'Label for a button that
will confirm suppression of a post.
{{Related|Flow-moderation-confirm}}
@@ -793,16 +793,16 @@
{{Related|Flow-moderation-confirm}}
{{Identical|Restore}}',
'flow-moderation-confirmation-suppress-post' => 'Message displayed
after a successful suppression of a post. Parameters:
-* $1 - the name of the user whose post is being moderated. GENDER supported.
+* $1 - the user whose post is being moderated. GENDER supported.
{{Related|Flow-moderation-confirmation}}',
'flow-moderation-confirmation-delete-post' => 'Message displayed after
a successful deletion of a post. Parameters:
-* $1 - the name of the user whose post is being moderated. GENDER supported.
+* $1 - the user whose post is being moderated. GENDER supported.
{{Related|Flow-moderation-confirmation}}',
'flow-moderation-confirmation-hide-post' => 'Message displayed after a
successful hiding of a post. Parameters:
-* $1 - the name of the user whose post is being moderated. GENDER supported.
+* $1 - the user whose post is being moderated. GENDER supported.
{{Related|Flow-moderation-confirmation}}',
'flow-moderation-confirmation-restore-post' => 'Message displayed after
a successful restoring of a post. Parameters:
-* $1 - the name of the user whose post is being restored. GENDER supported.
+* $1 - the user whose post is being restored. GENDER supported.
{{Related|Flow-moderation-confirmation}}',
'flow-moderation-title-suppress-topic' => 'Title for the moderation
confirmation dialog when a topic is being suppressed.
{{Related|Flow-moderation-title}}',
@@ -816,20 +816,20 @@
{{Related|Flow-moderation-title}}
{{Identical|Restore topic}}',
'flow-moderation-intro-suppress-topic' => 'Intro for the moderation
confirmation dialog when a topic is being suppressed. Parameters:
-* $1 - (Unused) the name of the user whose post is being suppressed. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a topic is being suppressed
+* $1 - the user whose post is being suppressed. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-intro-delete-topic' => 'Intro for the moderation
confirmation dialog when a topic is being deleted. Parameters:
-* $1 - (Unused) the name of the user whose post is being deleted. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a topic is being deleted
+* $1 - the user whose post is being deleted. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-intro-hide-topic' => 'Intro for the moderation
confirmation dialog when a topic is being hidden. Parameters:
-* $1 - (Unused) the name of the user whose post is being hidden. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a topic is being hidden
+* $1 - the user whose post is being hidden. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-intro-restore-topic' => 'Intro for the restore
confirmation dialog. Parameters:
-* $1 - (Unused) the name of the user whose post is being suppressed. GENDER
supported.
-* $2 - (Unused) the subject of the topic in which a topic is being suppressed
+* $1 - the user whose post is being suppressed. GENDER supported.
+* $3 - the user who is moderating the post. GENDER supported.
{{Related|Flow-moderation-intro}}',
'flow-moderation-confirm-suppress-topic' => 'Label for a button that
will confirm suppression of a topic.
{{Related|Flow-moderation-confirm}}
@@ -844,16 +844,15 @@
{{Related|Flow-moderation-confirm}}
{{Identical|Restore}}',
'flow-moderation-confirmation-suppress-topic' => 'Message displayed
after a successful suppression of a topic. Parameters:
-* $1 - the name of the user whose post is being moderated. GENDER supported.
+* $1 - the name of the user whose post is being moderated.
{{Related|Flow-moderation-confirmation}}',
'flow-moderation-confirmation-delete-topic' => 'Message displayed after
a successful deletion of a topic. Parameters:
-* $1 - the name of the user whose post is being moderated. GENDER supported.
+* $1 - the name of the user whose post is being moderated.
{{Related|Flow-moderation-confirmation}}',
'flow-moderation-confirmation-hide-topic' => 'Message displayed after a
successful hiding of a topic. Parameters:
-* $1 - the name of the user whose post is being moderated. GENDER supported.
+* $1 - the name of the user whose post is being moderated.
{{Related|Flow-moderation-confirmation}}',
- 'flow-moderation-confirmation-restore-topic' => 'Message displayed
after a successful restoring of a topic. Parameters:
-* $1 - the name of the user whose post is being restored. GENDER supported.
+ 'flow-moderation-confirmation-restore-topic' => 'Message displayed
after a successful restoring of a topic.
{{Related|Flow-moderation-confirmation}}',
'flow-topic-permalink-warning' => 'Displayed at the top of a page when
a person has clicked on a permanent link to a topic.
diff --git a/Resources.php b/Resources.php
index 6651fb9..d296401 100644
--- a/Resources.php
+++ b/Resources.php
@@ -133,6 +133,8 @@
'jquery.ui.dialog',
'jquery.spinner',
'jquery.byteLimit',
+ 'mediawiki.jqueryMsg',
+ 'mediawiki.user',
),
),
'ext.flow.editor' => $flowResourceTemplate + array(
diff --git a/modules/moderation/moderation.js b/modules/moderation/moderation.js
index 1ac028d..0760e7b 100644
--- a/modules/moderation/moderation.js
+++ b/modules/moderation/moderation.js
@@ -14,7 +14,7 @@
subject = $topicContainer.data( 'title' ),
$dialog = $( '<div />' ),
$form = $( '<form/>' ),
- targetType, apiCallback, $resultContainer, user;
+ targetType, apiCallback, $resultContainer, creatorName;
if ( $postContainer.length === 0 ) {
// moderating a topic
@@ -26,37 +26,67 @@
$resultContainer = $postContainer;
targetType = 'post';
}
- user = $resultContainer.data( 'creator-name' );
+ creatorName = $resultContainer.data( 'creator-name' );
$dialog
.addClass( 'flow-moderation-dialog' )
.dialog( {
+ // Messages used here:
+ // flow-moderation-title-suppress-post
+ // flow-moderation-title-delete-post
+ // flow-moderation-title-hide-post
+ // flow-moderation-title-restore-post
+ // flow-moderation-title-suppress-topic
+ // flow-moderation-title-delete-topic
+ // flow-moderation-title-hide-topic
+ // flow-moderation-title-restore-topic
'title' : mw.msg( 'flow-moderation-title-' +
moderationType + '-' + targetType ),
'modal' : true,
'buttons' : [
{
+ // Messages used here:
+ //
flow-moderation-confirm-suppress-post
+ //
flow-moderation-confirm-delete-post
+ //
flow-moderation-confirm-hide-post
+ //
flow-moderation-confirm-restore-post
+ //
flow-moderation-confirm-suppress-topic
+ //
flow-moderation-confirm-delete-topic
+ //
flow-moderation-confirm-hide-topic
+ //
flow-moderation-confirm-restore-topic
'text' : mw.msg(
'flow-moderation-confirm-' + moderationType + '-' + targetType ),
'click' : $(this).flow(
'getFormHandler',
apiCallback,
function() {
var res = [
$topicContainer.data( 'topic-id' ) ];
+
if (
$postContainer.length > 0 ) {
res.push( $postContainer.data( 'post-id' ) );
}
res.push(
moderationType, $form.find( '#flow-moderation-reason' ).val() );
+
return res;
},
undefined,
function( promise ) {
promise.done(
function( output ) {
-
var confirmationMsg = 'flow-moderation-confirmation-' + moderationType + '-' +
targetType,
+
// Messages used here:
+
// flow-moderation-confirmation-suppress-post
+
// flow-moderation-confirmation-delete-post
+
// flow-moderation-confirmation-hide-post
+
// flow-moderation-confirmation-restore-post
+
// flow-moderation-confirmation-suppress-topic
+
// flow-moderation-confirmation-delete-topic
+
// flow-moderation-confirmation-hide-topic
+
// flow-moderation-confirmation-restore-topic
+
var confirmationMsg = 'flow-moderation-confirmation-' +
+
moderationType + '-' + targetType,
$newContainer = $( output.rendered );
$dialog.empty()
.dialog( 'option', 'buttons', null )
.append(
$( '<p/>' )
-
.text( mw.msg( confirmationMsg, user ) )
+
.text( mw.msg( confirmationMsg, creatorName ) )
);
$resultContainer.replaceWith( $newContainer );
@@ -65,6 +95,7 @@
.fail(
function() {
var $errorDiv = $( '<div/>' ).flow( 'showError', arguments ),
$errors = $form.children( '.flow-error' );
+
if ( $errors.length ) {
$errors.replaceWith( $errorDiv );
} else {
@@ -83,7 +114,23 @@
.append(
$( 'label' )
.attr( 'for',
'flow-moderation-reason' )
- .text( mw.msg(
'flow-moderation-intro-' + moderationType + '-' + targetType, user, subject ) )
+ .text(
+ mw.message(
+ //
Messages used here:
+ //
flow-moderation-intro-suppress-topic
+ //
flow-moderation-intro-delete-topic
+ //
flow-moderation-intro-hide-topic
+ //
flow-moderation-intro-restore-topic
+ //
flow-moderation-intro-suppress-post
+ //
flow-moderation-intro-delete-post
+ //
flow-moderation-intro-hide-post
+ //
flow-moderation-intro-restore-post
+
'flow-moderation-intro-' + moderationType + '-' + targetType,
+
creatorName, // $1
+ null,
// $2 now unused
+ mw.user
// $3
+ ).text()
+ )
)
)
.append(
--
To view, visit https://gerrit.wikimedia.org/r/98368
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6a86a84396a8f27cf4ae07f4028e3309afce308
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits