Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
3fd624c2
Verified
Commit
3fd624c2
authored
4 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #16063 TIME 0:15 Can not update type + fix position
parent
6a4e63cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/home/controllers/TileController.php
+2
-5
2 additions, 5 deletions
src/app/home/controllers/TileController.php
with
2 additions
and
5 deletions
src/app/home/controllers/TileController.php
+
2
−
5
View file @
3fd624c2
...
...
@@ -50,8 +50,8 @@ class TileController
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body type is empty, not a string or not valid'
]);
}
elseif
(
!
Validator
::
stringType
()
->
notEmpty
()
->
validate
(
$body
[
'view'
]
??
null
)
||
!
in_array
(
$body
[
'view'
],
TileController
::
VIEWS
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body view is empty, not a string or not valid'
]);
}
elseif
(
!
Validator
::
intVal
()
->
notEmpty
()
->
validate
(
$body
[
'position'
]
??
null
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body position is
empty
or not an integer'
]);
}
elseif
(
!
Validator
::
intVal
()
->
validate
(
$body
[
'position'
]
??
null
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body position is
not set
or not an integer'
]);
}
$tiles
=
TileModel
::
get
([
...
...
@@ -93,15 +93,12 @@ class TileController
if
(
empty
(
$body
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body is empty'
]);
}
elseif
(
!
Validator
::
stringType
()
->
notEmpty
()
->
validate
(
$body
[
'type'
]
??
null
)
||
!
in_array
(
$body
[
'type'
],
TileController
::
TYPES
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body type is empty, not a string or not valid'
]);
}
elseif
(
!
Validator
::
stringType
()
->
notEmpty
()
->
validate
(
$body
[
'view'
]
??
null
)
||
!
in_array
(
$body
[
'view'
],
TileController
::
VIEWS
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body view is empty, not a string or not valid'
]);
}
TileModel
::
update
([
'set'
=>
[
'type'
=>
$body
[
'type'
],
'view'
=>
$body
[
'view'
],
'parameters'
=>
empty
(
$body
[
'parameters'
])
?
'{}'
:
json_encode
(
$body
[
'parameters'
])
],
...
...
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