Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchParapheur
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchParapheur
Commits
2e3d0c10
Commit
2e3d0c10
authored
3 years ago
by
Quentin Ribac
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #18091 TIME 0:45 saving signatureScaling in user preferences (int or false)
parent
112841a9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/user/controllers/UserController.php
+11
-8
11 additions, 8 deletions
src/app/user/controllers/UserController.php
with
11 additions
and
8 deletions
src/app/user/controllers/UserController.php
+
11
−
8
View file @
2e3d0c10
...
...
@@ -483,6 +483,8 @@ class UserController
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body notifications.instant is not a boolean'
]);
}
elseif
(
!
Validator
::
arrayType
()
->
each
(
Validator
::
in
(
$notificationsIds
))
->
validate
(
$body
[
'notifications'
][
'summaries'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body notifications.summaries is not an array or contains invalid IDs'
]);
}
elseif
(
!
Validator
::
oneOf
(
Validator
::
falseVal
(),
Validator
::
intVal
()
->
between
(
10
,
50
))
->
validate
(
$body
[
'signatureScaling'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body signatureScaling is neither false nor an integer between 10 and 50'
]);
}
$user
=
UserModel
::
getById
([
'id'
=>
$args
[
'id'
],
'select'
=>
[
'firstname'
,
'lastname'
]]);
...
...
@@ -492,14 +494,15 @@ class UserController
$body
[
'notifications'
][
'summaries'
]
=
array_values
(
array_unique
(
$body
[
'notifications'
][
'summaries'
]));
$preferences
=
json_encode
([
'lang'
=>
$body
[
'lang'
],
'writingMode'
=>
$body
[
'writingMode'
],
'writingSize'
=>
$body
[
'writingSize'
],
'writingColor'
=>
$body
[
'writingColor'
],
'notifications'
=>
[
'instant'
=>
$body
[
'notifications'
][
'instant'
],
'summaries'
=>
$body
[
'notifications'
][
'summaries'
],
],
'lang'
=>
$body
[
'lang'
],
'writingMode'
=>
$body
[
'writingMode'
],
'writingSize'
=>
$body
[
'writingSize'
],
'writingColor'
=>
$body
[
'writingColor'
],
'signatureScaling'
=>
$body
[
'signatureScaling'
],
'notifications'
=>
[
'instant'
=>
$body
[
'notifications'
][
'instant'
],
'summaries'
=>
$body
[
'notifications'
][
'summaries'
],
]
]);
if
(
!
is_string
(
$preferences
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Wrong format for user preferences data'
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment