[MediaWiki-commits] [Gerrit] mediawiki...Thanks[master]: Follow-up 6bb7939a79: use GenderCache

2018-01-23 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/406014 )

Change subject: Follow-up 6bb7939a79: use GenderCache
..

Follow-up 6bb7939a79: use GenderCache

Change-Id: I7511af52822ca2c99e08cf04cd07c880959325b4
---
M Thanks.hooks.php
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks 
refs/changes/14/406014/1

diff --git a/Thanks.hooks.php b/Thanks.hooks.php
index e325d98..376018a 100644
--- a/Thanks.hooks.php
+++ b/Thanks.hooks.php
@@ -101,6 +101,7 @@
);
}
 
+   $genderCache = 
MediaWikiServices::getInstance()->getGenderCache();
// Add 'thank' link
$tooltip = wfMessage( 'thanks-thank-tooltip' )
->params( $wgUser->getName(), 
$recipient->getName() )
@@ -113,7 +114,7 @@
'href' => SpecialPage::getTitleFor( 'Thanks', 
$rev->getId() )->getFullURL(),
'title' => $tooltip,
'data-revision-id' => $rev->getId(),
-   'data-recipient-gender' => 
$recipient->getOption( 'gender' ) ?: 'unknown',
+   'data-recipient-gender' => 
$genderCache->getGenderOf( $recipient->getName(), __METHOD__ ),
],
wfMessage( 'thanks-thank', $wgUser, 
$recipient->getName() )->text()
);

-- 
To view, visit https://gerrit.wikimedia.org/r/406014
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7511af52822ca2c99e08cf04cd07c880959325b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: [WIP] Failing test case for losing annotations

2018-01-23 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405994 )

Change subject: [WIP] Failing test case for losing annotations
..

[WIP] Failing test case for losing annotations

Change-Id: I5ca3d475760e14f3ece788107f3a002a17729ec9
---
M tests/dm/ve.dm.RebaseServer.test.js
1 file changed, 115 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/94/405994/1

diff --git a/tests/dm/ve.dm.RebaseServer.test.js 
b/tests/dm/ve.dm.RebaseServer.test.js
index aa6b9ec..51b1510 100644
--- a/tests/dm/ve.dm.RebaseServer.test.js
+++ b/tests/dm/ve.dm.RebaseServer.test.js
@@ -282,9 +282,124 @@
[ '1', 'deliver' ],
[ 'server', 'assertHist', 'abXYZ' ]
]
+   },
+   {
+   name: 'Double client-side rebase with 
annotation and other preceding transaction',
+   initialData: [
+   { type: 'paragraph' },
+   { type: '/paragraph' },
+   { type: 'internalList' },
+   { type: '/internalList' }
+   ],
+   clients: [ '1', '2' ],
+   ops: [
+   // Client 1 applies a local change that 
inserts 'Q'
+   [ '1', 'apply', [
+   [ 'insert', 1, [ 'Q' ], 3 ]
+   ] ],
+
+   // Client 2 submits two changes
+   [ '2', 'apply', [
+   [ 'insert', 1, [ 'a' ], 3 ]
+   ] ],
+   [ '2', 'submit' ],
+   [ '2', 'apply', [
+   [ 'insert', 2, [ 'b' ], 3 ]
+   ] ],
+   [ '2', 'submit' ],
+
+   // Client 1 rebases its local change 
over client 2's first change
+   [ '2', 'deliver' ],
+   [ 'server', 'assertHist', 'a' ],
+   [ '1', 'receive' ],
+   [ '1', 'assertHist', 'a/Q!' ],
+   // Client 1 submits its local change
+   [ '1', 'submit' ],
+
+   // Client 1 applies a local change that 
introduces an annotation
+   [ '1', 'apply', {
+   start: 1,
+   transactions: [
+   {
+   operations: [
+   { type: 
'retain', length: 2 },
+   { type: 
'replace', remove: [], insert: [
+   
[ 'X', [ 'h123' ] ],
+   
[ 'Y', [ 'h123' ] ],
+   
[ 'Z', [ 'h123' ] ]
+   ] },
+   { type: 
'retain', length: 3 }
+   ],
+   authorId: '1'
+   }
+   ],
+   stores: [
+   {
+   hashes: [ 
'h123' ],
+   hashStore: {
+   h123: {
+   
type: 'annotation',
+   
value: {
+   
type: 'textStyle/bold'
+   
}
+   

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: SurfaceSynchronizer: Also translate selections that are not ...

2018-01-22 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405833 )

Change subject: SurfaceSynchronizer: Also translate selections that are not 
mentioned in the change
..

SurfaceSynchronizer: Also translate selections that are not mentioned in the 
change

Otherwise, if a lot of content gets deleted, other authors' selections
will become out of bounds.

Change-Id: Ie1e1ac4385abf7bdf78b1f40c9394a001ae2f182
---
M src/dm/ve.dm.SurfaceSynchronizer.js
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/33/405833/1

diff --git a/src/dm/ve.dm.SurfaceSynchronizer.js 
b/src/dm/ve.dm.SurfaceSynchronizer.js
index 651f952..0f51f1b 100644
--- a/src/dm/ve.dm.SurfaceSynchronizer.js
+++ b/src/dm/ve.dm.SurfaceSynchronizer.js
@@ -142,6 +142,9 @@
change.applyTo( this.surface );
// HACK: After applyTo(), the selections are wrong and applying them 
could crash.
// The only reason this doesn't happen is because everything that tries 
to do that uses setTimeout().
+   // Translate the selections that aren't going to be overwritten by 
change.selections
+   this.applyNewSelections( this.authorSelections, change );
+   // Apply the overwrites from change.selections
this.applyNewSelections( change.selections );
 };
 
@@ -241,6 +244,7 @@
translatedSelection = newSelections[ authorId ];
}
if ( !translatedSelection.equals( this.authorSelections[ 
authorId ] ) ) {
+   // This works correctly even if newSelections === 
this.authorSelections
this.authorSelections[ authorId ] = translatedSelection;
this.emit( 'authorSelect', authorId );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/405833
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1e1ac4385abf7bdf78b1f40c9394a001ae2f182
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: rebaser: Fix sequencing of server operations

2018-01-22 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405832 )

Change subject: rebaser: Fix sequencing of server operations
..

rebaser: Fix sequencing of server operations

pendingForDoc was not actually ever being populated.
Fixing this sequencing resulted in the artificial delay (typically 5s)
being applied to every event consecutively, which is not what we want
(it's *very* slow), so make the delays run in parallel with waiting
for the previous step (and its delay) to finish.

Change-Id: Ia7a53600d2b0626f81f306aeb72cecbbe00fe7ac
---
M rebaser/server.js
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/32/405832/1

diff --git a/rebaser/server.js b/rebaser/server.js
index 1199912..2bf6280 100644
--- a/rebaser/server.js
+++ b/rebaser/server.js
@@ -83,7 +83,6 @@
 
 function* onSubmitChange( context, data ) {
var change, applied;
-   yield wait( artificialDelay );
change = ve.dm.Change.static.deserialize( data.change, null, true );
applied = yield rebaseServer.applyChange( context.docName, 
context.authorId, data.backtrack, change );
if ( !applied.isEmpty() ) {
@@ -148,13 +147,14 @@
 }
 
 function addStep( docName, generatorFunc ) {
-   var pending = Promise.resolve( pendingForDoc.get( docName ) );
-   pending = pending
+   var pending = Promise.resolve( pendingForDoc.get( docName ) ),
+   delayPromise = wait( artificialDelay );
+   pending = Promise.all( [ pending, delayPromise ] )
.then( function () {
return ve.spawn( generatorFunc );
} )
.catch( logError );
-   pendingForDoc.set( pending );
+   pendingForDoc.set( docName, pending );
 }
 
 handlers = {

-- 
To view, visit https://gerrit.wikimedia.org/r/405832
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7a53600d2b0626f81f306aeb72cecbbe00fe7ac
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Flow[wmf/1.31.0-wmf.17]: Revert "Improve error-handling for OptInController"

2018-01-22 Thread Catrope (Code Review)
Hello Mattflaschen, Sbisson, jenkins-bot,

I'd like you to do a code review.  Please visit

https://gerrit.wikimedia.org/r/405754

to review the following change.


Change subject: Revert "Improve error-handling for OptInController"
..

Revert "Improve error-handling for OptInController"

This reverts commit cbb86c9a06058af4b2d37e2c00bef0df69e3f41d.

Change-Id: Ie2635b1f9cf32d04ffe4bd2437c605e191507414
---
M Hooks.php
M container.php
M extension.json
M includes/Import/OptInController.php
A includes/Import/OptInUpdate.php
5 files changed, 70 insertions(+), 111 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/54/405754/1

diff --git a/Hooks.php b/Hooks.php
index 052fe03..de887c1 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -8,7 +8,7 @@
 use Flow\Exception\PermissionException;
 use Flow\Data\Listener\RecentChangesListener;
 use Flow\Formatter\CheckUserQuery;
-use Flow\Import\OptInController;
+use Flow\Import\OptInUpdate;
 use Flow\Model\UUID;
 use Flow\OccupationController;
 use Flow\SpamFilter\AbuseFilter;
@@ -1754,20 +1754,20 @@
$after = $user->getBoolOption( BETA_FEATURE_FLOW_USER_TALK_PAGE 
);
$action = null;
 
-   $optInController = Flow\Container::get( 'controller.opt_in' );
if ( !$before && $after ) {
-   $action = OptInController::$ENABLE;
+   $action = OptInUpdate::$ENABLE;
// Check if the user had a flow board
-   if ( !$optInController->hasFlowBoardArchive( $user ) ) {
+   $c = new Flow\Import\OptInController();
+   if ( !$c->hasFlowBoardArchive( $user ) ) {
// Enable the guided tour by setting the cookie

RequestContext::getMain()->getRequest()->response()->setCookie( 
'Flow_optIn_guidedTour', '1' );
}
} elseif ( $before && !$after ) {
-   $action = OptInController::$DISABLE;
+   $action = OptInUpdate::$DISABLE;
}
 
if ( $action ) {
-   $optInController->initiateChange( $action, 
$user->getTalkPage(), $user );
+   DeferredUpdates::addUpdate( new OptInUpdate( $action, 
$user->getTalkPage(), $user ) );
}
 
return true;
diff --git a/container.php b/container.php
index ff79ba9..e7ab7df 100644
--- a/container.php
+++ b/container.php
@@ -781,22 +781,6 @@
 // must always happen before calling flow code.
 $c['occupation_controller'] = FlowHooks::getOccupationController();
 
-$c['helper.archive_name'] = function ( $c ) {
-   return new Flow\Import\ArchiveNameHelper();
-};
-
-$c['controller.opt_in'] = function ( $c ) {
-   return new Flow\Import\OptInController(
-   $c['occupation_controller'],
-   $c['controller.notification'],
-   $c['helper.archive_name'],
-   $c['db.factory'],
-   $c['default_logger'],
-   $c['occupation_controller']->getTalkpageManager()
-
-   );
-};
-
 $c['controller.notification'] = function ( $c ) {
global $wgContLang;
return new Flow\NotificationController( $wgContLang, 
$c['repository.tree'] );
diff --git a/extension.json b/extension.json
index e766273..ce0ab2d 100644
--- a/extension.json
+++ b/extension.json
@@ -1109,6 +1109,7 @@
"Flow\\Import\\LiquidThreadsApi\\ScriptedImportRevision": 
"includes/Import/LiquidThreadsApi/Objects.php",
"Flow\\Import\\LiquidThreadsApi\\TopicIterator": 
"includes/Import/LiquidThreadsApi/Iterators.php",
"Flow\\Import\\OptInController": 
"includes/Import/OptInController.php",
+   "Flow\\Import\\OptInUpdate": "includes/Import/OptInUpdate.php",
"Flow\\Import\\PageImportState": "includes/Import/Importer.php",
"Flow\\Import\\Plain\\ImportHeader": 
"includes/Import/Plain/ImportHeader.php",
"Flow\\Import\\Plain\\ObjectRevision": 
"includes/Import/Plain/ObjectRevision.php",
diff --git a/includes/Import/OptInController.php 
b/includes/Import/OptInController.php
index 49d9e84..7fd1171 100644
--- a/includes/Import/OptInController.php
+++ b/includes/Import/OptInController.php
@@ -4,10 +4,7 @@
 
 use DateTime;
 use DateTimeZone;
-use DeferredUpdates;
 use DerivativeContext;
-use Exception;
-use Flow\DbFactory;
 use Flow\Collection\HeaderCollection;
 use Flow\Content\BoardContent;
 use Flow\Exception\InvalidDataException;
@@ -17,9 +14,7 @@
 use Flow\WorkflowLoader;
 use Flow\WorkflowLoaderFactory;
 use IContextSource;
-use Psr\Log\LoggerInterface;
 use MovePage;
-use MWExceptionHandler;
 use Parser;
 use ParserOptions;
 use RequestContext;
@@ -34,8 +29,6 @@
  * Entry point for enabling Flow on a page.
  */
 class 

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: SurfaceSynchronizer: Translate selections when unapplying

2018-01-20 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405549 )

Change subject: SurfaceSynchronizer: Translate selections when unapplying
..

SurfaceSynchronizer: Translate selections when unapplying

Bug: T185395
Change-Id: If5df0b5755e56f99ca981bcee88485a4b71ddd40
---
M src/dm/ve.dm.SurfaceSynchronizer.js
1 file changed, 2 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/49/405549/1

diff --git a/src/dm/ve.dm.SurfaceSynchronizer.js 
b/src/dm/ve.dm.SurfaceSynchronizer.js
index ddd679e..8e01c18 100644
--- a/src/dm/ve.dm.SurfaceSynchronizer.js
+++ b/src/dm/ve.dm.SurfaceSynchronizer.js
@@ -147,13 +147,9 @@
  * @inheritdoc
  */
 ve.dm.SurfaceSynchronizer.prototype.unapplyChange = function ( change ) {
-   var authorId, nullSelections = {};
-   // Author selections are potentially invalid now, null them all out
-   for ( authorId in this.authorSelections ) {
-   nullSelections[ authorId ] = new ve.dm.NullSelection( this.doc 
);
-   }
-   this.applyNewSelections( nullSelections );
change.unapplyTo( this.surface );
+   // Translate all selections for what we just unapplied
+   this.applyNewSelections( this.authorSelections, change.reversed() );
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/405549
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If5df0b5755e56f99ca981bcee88485a4b71ddd40
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: SurfaceSynchronizer: Clear author selections when unapplying

2018-01-20 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405546 )

Change subject: SurfaceSynchronizer: Clear author selections when unapplying
..

SurfaceSynchronizer: Clear author selections when unapplying

The selections we have are no longer valid, and we have no way
of knowing what the valid ones would be.

Bug: T185395
Change-Id: I075fc300142489f463f78d8864820ea53d3d080a
---
M src/dm/ve.dm.SurfaceSynchronizer.js
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/46/405546/1

diff --git a/src/dm/ve.dm.SurfaceSynchronizer.js 
b/src/dm/ve.dm.SurfaceSynchronizer.js
index 202997f..ddd679e 100644
--- a/src/dm/ve.dm.SurfaceSynchronizer.js
+++ b/src/dm/ve.dm.SurfaceSynchronizer.js
@@ -147,6 +147,12 @@
  * @inheritdoc
  */
 ve.dm.SurfaceSynchronizer.prototype.unapplyChange = function ( change ) {
+   var authorId, nullSelections = {};
+   // Author selections are potentially invalid now, null them all out
+   for ( authorId in this.authorSelections ) {
+   nullSelections[ authorId ] = new ve.dm.NullSelection( this.doc 
);
+   }
+   this.applyNewSelections( nullSelections );
change.unapplyTo( this.surface );
 };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/405546
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I075fc300142489f463f78d8864820ea53d3d080a
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...InputBox[wmf/1.31.0-wmf.17]: Follow-up dd0a0035e: make useve work together with prefix

2018-01-19 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405390 )

Change subject: Follow-up dd0a0035e: make useve work together with prefix
..

Follow-up dd0a0035e: make useve work together with prefix

If you set useve=true, the prefix was ignored. This was because
the prefixing code only looked for action=edit, not for veaction=edit.

Bug: T185367
Change-Id: I7b14f76571aab302cf76a3383066f030881c1454
(cherry picked from commit 64364df4455065a3d12ae9905f0c45d39566d72e)
---
M InputBox.hooks.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/InputBox 
refs/changes/90/405390/1

diff --git a/InputBox.hooks.php b/InputBox.hooks.php
index 25aa98d..d94c422 100644
--- a/InputBox.hooks.php
+++ b/InputBox.hooks.php
@@ -84,7 +84,7 @@
$request,
$wiki
) {
-   if ( $wiki->getAction( $request ) !== 'edit' ) {
+   if ( $wiki->getAction( $request ) !== 'edit' && 
$request->getText( 'veaction' ) !== 'edit' ) {
// not our problem
return true;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/405390
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b14f76571aab302cf76a3383066f030881c1454
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/InputBox
Gerrit-Branch: wmf/1.31.0-wmf.17
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...InputBox[master]: Follow-up dd0a0035e: make useve work together with prefix

2018-01-19 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405389 )

Change subject: Follow-up dd0a0035e: make useve work together with prefix
..

Follow-up dd0a0035e: make useve work together with prefix

If you set useve=true, the prefix was ignored. This was because
the prefixing code only looked for action=edit, not for veaction=edit.

Bug: T185367
Change-Id: I7b14f76571aab302cf76a3383066f030881c1454
---
M InputBox.hooks.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/InputBox 
refs/changes/89/405389/1

diff --git a/InputBox.hooks.php b/InputBox.hooks.php
index 25aa98d..d94c422 100644
--- a/InputBox.hooks.php
+++ b/InputBox.hooks.php
@@ -84,7 +84,7 @@
$request,
$wiki
) {
-   if ( $wiki->getAction( $request ) !== 'edit' ) {
+   if ( $wiki->getAction( $request ) !== 'edit' && 
$request->getText( 'veaction' ) !== 'edit' ) {
// not our problem
return true;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/405389
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b14f76571aab302cf76a3383066f030881c1454
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/InputBox
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Thanks[master]: revthank: Embed gender of thanks recipients in the page

2018-01-19 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405380 )

Change subject: revthank: Embed gender of thanks recipients in the page
..

revthank: Embed gender of thanks recipients in the page

That way we don't have to do an API request to get the gender,
and we'll also be able to use gender-sensitive messages in the
confirmation step.

Bug: T159302
Change-Id: I9097bd976f8da1632577a3f4438b9f1186baca88
---
M Thanks.hooks.php
M modules/ext.thanks.revthank.js
2 files changed, 8 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks 
refs/changes/80/405380/1

diff --git a/Thanks.hooks.php b/Thanks.hooks.php
index a55c7fb..e325d98 100644
--- a/Thanks.hooks.php
+++ b/Thanks.hooks.php
@@ -113,6 +113,7 @@
'href' => SpecialPage::getTitleFor( 'Thanks', 
$rev->getId() )->getFullURL(),
'title' => $tooltip,
'data-revision-id' => $rev->getId(),
+   'data-recipient-gender' => 
$recipient->getOption( 'gender' ) ?: 'unknown',
],
wfMessage( 'thanks-thank', $wgUser, 
$recipient->getName() )->text()
);
diff --git a/modules/ext.thanks.revthank.js b/modules/ext.thanks.revthank.js
index 872703d..e577d28 100644
--- a/modules/ext.thanks.revthank.js
+++ b/modules/ext.thanks.revthank.js
@@ -36,11 +36,9 @@
.then(
// Success
function () {
-   var username = $thankLink.closest(
-   source === 'history' ? 'li' : 
'td'
-   ).find( 'a.mw-userlink' ).text();
-   // Get the user who was thanked (for 
gender purposes)
-   return mw.thanks.getUserGender( 
username );
+   $thankElement.before( mw.message( 
'thanks-thanked', mw.user, $thankLink.data( 'recipient-gender' ) ).escaped() );
+   $thankElement.remove();
+   mw.thanks.thanked.push( $thankLink );
},
// Fail
function ( errorCode ) {
@@ -57,31 +55,25 @@
OO.ui.alert( mw.msg( 
'thanks-error-undefined', errorCode ) );
}
}
-   )
-   .then( function ( recipientGender ) {
-   $thankElement.before( mw.message( 
'thanks-thanked', mw.user, recipientGender ).escaped() );
-   $thankElement.remove();
-   mw.thanks.thanked.push( $thankLink );
-   } );
+   );
}
 
function addActionToLinks( $content ) {
+   var $thankLink = $content.find( 'a.mw-thanks-thank-link' );
if ( mw.config.get( 'thanks-confirmation-required' ) ) {
-   $content.find( 'a.mw-thanks-thank-link' ).confirmable( {
+   $thankLink.confirmable( {
i18n: {
confirm: mw.msg( 
'thanks-confirmation2', mw.user ),
noTitle: mw.msg( 
'thanks-thank-tooltip-no', mw.user ),
yesTitle: mw.msg( 
'thanks-thank-tooltip-yes', mw.user )
},
handler: function ( e ) {
-   var $thankLink = $( this );
e.preventDefault();
sendThanks( $thankLink, 
$thankLink.closest( '.jquery-confirmable-wrapper' ) );
}
} );
} else {
-   $content.find( 'a.mw-thanks-thank-link' ).click( 
function ( e ) {
-   var $thankLink = $( this );
+   $thankLink.click( function ( e ) {
e.preventDefault();
sendThanks( $thankLink, $thankLink );
} );

-- 
To view, visit https://gerrit.wikimedia.org/r/405380
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9097bd976f8da1632577a3f4438b9f1186baca88
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list

[MediaWiki-commits] [Gerrit] mediawiki...Thanks[master]: revthank: Clarify confirmation message and change yes/no mes...

2018-01-19 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405381 )

Change subject: revthank: Clarify confirmation message and change yes/no 
messages
..

revthank: Clarify confirmation message and change yes/no messages

Bug: T159302
Change-Id: I49ac7d644f207fe76a49efd650b727e33049b3af
---
M extension.json
M i18n/en.json
M modules/ext.thanks.revthank.js
3 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks 
refs/changes/81/405381/1

diff --git a/extension.json b/extension.json
index 5e30b49..89dbae3 100644
--- a/extension.json
+++ b/extension.json
@@ -76,7 +76,7 @@
"thanks-confirmation2",
"thanks-thank-tooltip-no",
"thanks-thank-tooltip-yes",
-   "ok",
+   "thanks-button-thank",
"cancel"
],
"dependencies": [
diff --git a/i18n/en.json b/i18n/en.json
index 80d8501..50464f4 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -22,7 +22,7 @@
"thanks-thank-tooltip": "{{GENDER:$1|Send}} a thank you notification to 
this {{GENDER:$2|user}}",
"thanks-thank-tooltip-no": "{{GENDER:$1|Cancel}} the thank you 
notification",
"thanks-thank-tooltip-yes": "{{GENDER:$1|Send}} the thank you 
notification",
-   "thanks-confirmation2": "{{GENDER:$1|Send}} public thanks for this 
edit?",
+   "thanks-confirmation2": "All thanks are public. {{GENDER:$1|Send}} 
thanks?",
"thanks-thanked-notice": "{{GENDER:$3|You}} thanked $1 for 
{{GENDER:$2|his|her|their}} edit.",
"thanks": "Send thanks",
"thanks-submit": "Send thanks",
diff --git a/modules/ext.thanks.revthank.js b/modules/ext.thanks.revthank.js
index e577d28..cf4e5c3 100644
--- a/modules/ext.thanks.revthank.js
+++ b/modules/ext.thanks.revthank.js
@@ -64,7 +64,9 @@
$thankLink.confirmable( {
i18n: {
confirm: mw.msg( 
'thanks-confirmation2', mw.user ),
+   no: mw.msg( 'cancel' ),
noTitle: mw.msg( 
'thanks-thank-tooltip-no', mw.user ),
+   yes: mw.msg( 'thanks-button-thank', 
mw.user, $thankLink.data( 'recipient-gender' ) ),
yesTitle: mw.msg( 
'thanks-thank-tooltip-yes', mw.user )
},
handler: function ( e ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/405381
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I49ac7d644f207fe76a49efd650b727e33049b3af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Catrope 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikimedia/annualreport[master]: Piwik: Complement protocol-relative URL with `https://`

2018-01-19 Thread Catrope (Code Review)
Catrope has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/405378 )

Change subject: Piwik: Complement protocol-relative URL with `https://`
..


Piwik: Complement protocol-relative URL with `https://`

Also remove unnecessary `type` attribute as it's default
in HTML5.

Bug: T185357
Change-Id: Ib4747d0ca5a921ff79bf80e8cc1a02ebb7c167fe
---
M 2017/community.html
M 2017/donors.html
M 2017/financials.html
M 2017/index.html
M 2017/leadership.html
M 2017/stories.html
6 files changed, 24 insertions(+), 36 deletions(-)

Approvals:
  Catrope: Verified; Looks good to me, approved



diff --git a/2017/community.html b/2017/community.html
index 350329b..cb8cad2 100644
--- a/2017/community.html
+++ b/2017/community.html
@@ -21,24 +21,22 @@
 
 
 
-
 
-
+