Fix user options bugs that caused bad display. Fixes #213
This commit is contained in:
parent
4bb79a83f6
commit
f2530601cc
@ -26,6 +26,7 @@ function exceptionHandler($exception) {
|
|||||||
set_exception_handler('exceptionHandler');
|
set_exception_handler('exceptionHandler');
|
||||||
|
|
||||||
R::setup('sqlite:'.__DIR__.'/taskboard.db');
|
R::setup('sqlite:'.__DIR__.'/taskboard.db');
|
||||||
|
R::setAutoResolve(TRUE);
|
||||||
createInitialUser();
|
createInitialUser();
|
||||||
|
|
||||||
$app->notFound(function() use ($app, $jsonResponse) {
|
$app->notFound(function() use ($app, $jsonResponse) {
|
||||||
|
@ -380,7 +380,7 @@ function createInitialUser() {
|
|||||||
$options->showAnimations = true;
|
$options->showAnimations = true;
|
||||||
$options->showAssignee = true;
|
$options->showAssignee = true;
|
||||||
|
|
||||||
$admin->ownOptions[] = $options;
|
$admin->xownOptionList[] = $options;
|
||||||
|
|
||||||
R::store($admin);
|
R::store($admin);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ $app->get('/users/current', function() use($app, $jsonResponse) {
|
|||||||
if (validateToken()) {
|
if (validateToken()) {
|
||||||
$user = getUser();
|
$user = getUser();
|
||||||
if (null != $user) {
|
if (null != $user) {
|
||||||
$userOptions = R::exportAll($user->ownOption);
|
$userOptions = R::exportAll($user->xownOptionList);
|
||||||
$options = [
|
$options = [
|
||||||
'tasksOrder' => $userOptions[0]['tasks_order'],
|
'tasksOrder' => $userOptions[0]['tasks_order'],
|
||||||
'showAssignee' => $userOptions[0]['show_assignee'] == 1,
|
'showAssignee' => $userOptions[0]['show_assignee'] == 1,
|
||||||
@ -163,9 +163,9 @@ $app->post('/users/current/options', function() use ($app, $jsonResponse) {
|
|||||||
if (validateToken()) {
|
if (validateToken()) {
|
||||||
$user = getUser();
|
$user = getUser();
|
||||||
|
|
||||||
$user->ownOption[1]->tasksOrder = $data->tasksOrder;
|
$user->xownOptionList[0]->tasksOrder = $data->tasksOrder;
|
||||||
$user->ownOption[1]->showAssignee = $data->showAssignee;
|
$user->xownOptionList[0]->showAssignee = $data->showAssignee;
|
||||||
$user->ownOption[1]->showAnimations = $data->showAnimations;
|
$user->xownOptionList[0]->showAnimations = $data->showAnimations;
|
||||||
R::store($user);
|
R::store($user);
|
||||||
|
|
||||||
$jsonResponse->data = $data;
|
$jsonResponse->data = $data;
|
||||||
@ -198,13 +198,16 @@ $app->post('/users', function() use($app, $jsonResponse) {
|
|||||||
$user->defaultBoard = $data->defaultBoard;
|
$user->defaultBoard = $data->defaultBoard;
|
||||||
$user->salt = password_hash($data->username . time(), PASSWORD_BCRYPT);
|
$user->salt = password_hash($data->username . time(), PASSWORD_BCRYPT);
|
||||||
$user->password = password_hash($data->password, PASSWORD_BCRYPT, array('salt' => $user->salt));
|
$user->password = password_hash($data->password, PASSWORD_BCRYPT, array('salt' => $user->salt));
|
||||||
|
|
||||||
$options = R::dispense('option');
|
$options = R::dispense('option');
|
||||||
$options->newTaskPosition = 0; // Bottom of column (1 == top of column)
|
$options->tasksOrder = 0; // Bottom of column (1 == top of column)
|
||||||
$options->animate = true;
|
$options->showAnimations = true;
|
||||||
$user->ownOptions = $options;
|
$options->showAssignee = true;
|
||||||
|
$user->xownOptionList[] = $options;
|
||||||
|
|
||||||
R::store($user);
|
R::store($user);
|
||||||
addUserToBoard($data->defaultBoard, $user);
|
addUserToBoard($data->defaultBoard, $user);
|
||||||
|
|
||||||
if (property_exists($data, 'boardAccess') && is_array($data->boardAccess)) {
|
if (property_exists($data, 'boardAccess') && is_array($data->boardAccess)) {
|
||||||
foreach($data->boardAccess as $board) {
|
foreach($data->boardAccess as $board) {
|
||||||
addUserToBoard($board, $user);
|
addUserToBoard($board, $user);
|
||||||
|
27
composer.lock
generated
27
composer.lock
generated
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"_readme": [
|
"_readme": [
|
||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "bcd0d77c65d6fda9ece3a2600d80347c",
|
"hash": "bcd0d77c65d6fda9ece3a2600d80347c",
|
||||||
|
"content-hash": "99f3562842898771c354cfc411491902",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "firebase/php-jwt",
|
"name": "firebase/php-jwt",
|
||||||
@ -135,16 +136,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpmailer/phpmailer",
|
"name": "phpmailer/phpmailer",
|
||||||
"version": "v5.2.9",
|
"version": "v5.2.14",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||||
"reference": "73b61679809615850706f1dbf88e6df2ddc05745"
|
"reference": "e774bc9152de85547336e22b8926189e582ece95"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/73b61679809615850706f1dbf88e6df2ddc05745",
|
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e774bc9152de85547336e22b8926189e582ece95",
|
||||||
"reference": "73b61679809615850706f1dbf88e6df2ddc05745",
|
"reference": "e774bc9152de85547336e22b8926189e582ece95",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -152,17 +153,25 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpdocumentor/phpdocumentor": "*",
|
"phpdocumentor/phpdocumentor": "*",
|
||||||
"phpunit/phpunit": "4.1.*"
|
"phpunit/phpunit": "4.7.*"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"league/oauth2-client": "Needed for XOAUTH2 authentication",
|
||||||
|
"league/oauth2-google": "Needed for Gmail XOAUTH2"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"class.phpmailer.php",
|
"class.phpmailer.php",
|
||||||
|
"class.phpmaileroauth.php",
|
||||||
|
"class.phpmaileroauthgoogle.php",
|
||||||
|
"class.smtp.php",
|
||||||
"class.pop3.php",
|
"class.pop3.php",
|
||||||
"class.smtp.php"
|
"extras/EasyPeasyICS.php",
|
||||||
|
"extras/ntlm_sasl_client.php"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "http://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
"LGPL-2.1"
|
"LGPL-2.1"
|
||||||
],
|
],
|
||||||
@ -184,7 +193,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||||
"time": "2014-09-26 18:33:30"
|
"time": "2015-11-01 10:15:28"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "slim/slim",
|
"name": "slim/slim",
|
||||||
|
Reference in New Issue
Block a user