Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Pleroma
admin-fe
Commits
8df49caf
Commit
8df49caf
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-config-object-parse' into 'master'
Fix parse object type config See merge request
pleroma/admin-fe!29
parents
5670be0e
c6dcc946
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!29
Fix parse object type config
Pipeline
#16230
passed
5 years ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/store/modules/normalizers.js
+20
-0
20 additions, 0 deletions
src/store/modules/normalizers.js
with
20 additions
and
0 deletions
src/store/modules/normalizers.js
+
20
−
0
View file @
8df49caf
...
...
@@ -107,8 +107,14 @@ export const parseTuples = (tuples, key) => {
nonAtomsTuples
.
includes
(
item
.
tuple
[
0
])
?
accum
[
item
.
tuple
[
0
].
substr
(
1
)]
=
parseNonAtomTuples
(
item
.
tuple
[
1
])
:
accum
[
item
.
tuple
[
0
].
substr
(
1
)]
=
parseTuples
(
item
.
tuple
[
1
])
}
else
if
(
Array
.
isArray
(
item
.
tuple
[
1
]))
{
accum
[
item
.
tuple
[
0
].
substr
(
1
)]
=
item
.
tuple
[
1
]
}
else
if
(
item
.
tuple
[
1
]
&&
typeof
item
.
tuple
[
1
]
===
'
object
'
&&
'
tuple
'
in
item
.
tuple
[
1
])
{
accum
[
item
.
tuple
[
0
].
substr
(
1
)]
=
item
.
tuple
[
1
][
'
tuple
'
].
join
(
'
.
'
)
}
else
if
(
item
.
tuple
[
1
]
&&
typeof
item
.
tuple
[
1
]
===
'
object
'
)
{
nonAtomsObjects
.
includes
(
item
.
tuple
[
0
])
?
accum
[
item
.
tuple
[
0
].
substr
(
1
)]
=
parseNonAtomObject
(
item
.
tuple
[
1
])
:
accum
[
item
.
tuple
[
0
].
substr
(
1
)]
=
parseObject
(
item
.
tuple
[
1
])
}
else
{
key
===
'
mrf_user_allowlist
'
?
accum
[
item
.
tuple
[
0
]]
=
item
.
tuple
[
1
]
...
...
@@ -125,6 +131,20 @@ const parseNonAtomTuples = (tuples) => {
},
{})
}
const
parseNonAtomObject
=
(
object
)
=>
{
return
Object
.
keys
(
object
).
reduce
((
acc
,
item
)
=>
{
acc
[
item
]
=
object
[
item
]
return
acc
},
{})
}
const
parseObject
=
(
object
)
=>
{
return
Object
.
keys
(
object
).
reduce
((
acc
,
item
)
=>
{
acc
[
item
.
substr
(
1
)]
=
object
[
item
]
return
acc
},
{})
}
export
const
valueHasTuples
=
(
key
,
value
)
=>
{
const
valueIsArrayOfNonObjects
=
Array
.
isArray
(
value
)
&&
value
.
length
>
0
&&
typeof
value
[
0
]
!==
'
object
'
return
key
===
'
meta
'
||
...
...
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