[MediaWiki-commits] [Gerrit] wikimedia...discernatron[master]: Fix user creation

2016-09-12 Thread EBernhardson (Code Review)
EBernhardson has submitted this change and it was merged.

Change subject: Fix user creation
..


Fix user creation

The patch to add a persistent toggle for the scoring interface switch
had a bug that prevented new users from being created. With this update
that should now work appropriately.

Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
---
M app.php
M src/RelevanceScoring/Repository/UsersRepository.php
2 files changed, 4 insertions(+), 3 deletions(-)

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



diff --git a/app.php b/app.php
index 54718b5..ca4af5a 100644
--- a/app.php
+++ b/app.php
@@ -132,6 +132,7 @@
 return $app->redirect($app->path('oauth_authorize'));
 }
 $user->extra['last_authorized'] = time();
+$user->extra['scoringInterface'] = 'classic';
 $app['search.repository.users']->updateUser($user);
 $session->set('user', $user);
 }
diff --git a/src/RelevanceScoring/Repository/UsersRepository.php 
b/src/RelevanceScoring/Repository/UsersRepository.php
index f2db9c8..bd84195 100644
--- a/src/RelevanceScoring/Repository/UsersRepository.php
+++ b/src/RelevanceScoring/Repository/UsersRepository.php
@@ -22,8 +22,8 @@
 {
 $properties = [
 'name' => $user->name,
-'edit_count' => $user->extra['editCount'],
-'scoring_interface' => $user->extra['scoringInterface'],
+'edit_count' => isset($user->extra['editCount']) ? 
$user->extra['editCount'] : 0,
+'scoring_interface' => isset($user->extra['scoringInterface']) ? 
$user->extra['scoringInterface'] : 'classic',
 ];
 
 if ($this->userExists($user)) {
@@ -75,7 +75,7 @@
 $user->name = $row['name'];
 $user->extra = [
 'editCount' => $row['edit_count'],
-'scoringInterface' => $row['scoringInterface'],
+'scoringInterface' => $row['scoring_interface'],
 ];
 
 return new Some($user);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/discernatron
Gerrit-Branch: master
Gerrit-Owner: EBernhardson 
Gerrit-Reviewer: EBernhardson 

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


[MediaWiki-commits] [Gerrit] wikimedia...discernatron[master]: Fix user creation

2016-09-12 Thread EBernhardson (Code Review)
EBernhardson has uploaded a new change for review.

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

Change subject: Fix user creation
..

Fix user creation

The patch to add a persistent toggle for the scoring interface switch
had a bug that prevented new users from being created. With this update
that should now work appropriately.

Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
---
M app.php
M src/RelevanceScoring/Repository/UsersRepository.php
2 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/discernatron 
refs/changes/79/310179/1

diff --git a/app.php b/app.php
index 54718b5..ca4af5a 100644
--- a/app.php
+++ b/app.php
@@ -132,6 +132,7 @@
 return $app->redirect($app->path('oauth_authorize'));
 }
 $user->extra['last_authorized'] = time();
+$user->extra['scoringInterface'] = 'classic';
 $app['search.repository.users']->updateUser($user);
 $session->set('user', $user);
 }
diff --git a/src/RelevanceScoring/Repository/UsersRepository.php 
b/src/RelevanceScoring/Repository/UsersRepository.php
index f2db9c8..bd84195 100644
--- a/src/RelevanceScoring/Repository/UsersRepository.php
+++ b/src/RelevanceScoring/Repository/UsersRepository.php
@@ -22,8 +22,8 @@
 {
 $properties = [
 'name' => $user->name,
-'edit_count' => $user->extra['editCount'],
-'scoring_interface' => $user->extra['scoringInterface'],
+'edit_count' => isset($user->extra['editCount']) ? 
$user->extra['editCount'] : 0,
+'scoring_interface' => isset($user->extra['scoringInterface']) ? 
$user->extra['scoringInterface'] : 'classic',
 ];
 
 if ($this->userExists($user)) {
@@ -75,7 +75,7 @@
 $user->name = $row['name'];
 $user->extra = [
 'editCount' => $row['edit_count'],
-'scoringInterface' => $row['scoringInterface'],
+'scoringInterface' => $row['scoring_interface'],
 ];
 
 return new Some($user);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/discernatron
Gerrit-Branch: master
Gerrit-Owner: EBernhardson 

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