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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Angelina Filippova
admin-fe
Commits
00dce737
Commit
00dce737
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Fix deleting settings when changing between mailer adapters
parent
fd0392c1
No related branches found
No related tags found
No related merge requests found
Pipeline
#21469
passed
5 years ago
Stage: lint
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/settings.js
+10
-0
10 additions, 0 deletions
src/api/settings.js
src/store/modules/settings.js
+11
-7
11 additions, 7 deletions
src/store/modules/settings.js
with
21 additions
and
7 deletions
src/api/settings.js
+
10
−
0
View file @
00dce737
...
...
@@ -30,6 +30,16 @@ export async function updateSettings(configs, authHost, token) {
})
}
export
async
function
removeSettings
(
configs
,
authHost
,
token
)
{
return
await
request
({
baseURL
:
baseName
(
authHost
),
url
:
`/api/pleroma/admin/config`
,
method
:
'
post
'
,
headers
:
authHeaders
(
token
),
data
:
{
configs
}
})
}
export
async
function
uploadMedia
(
file
,
authHost
,
token
)
{
const
formData
=
new
FormData
()
formData
.
append
(
'
file
'
,
file
)
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/settings.js
+
11
−
7
View file @
00dce737
import
{
fetchDescription
,
fetchSettings
,
updateSettings
,
uploadMedia
}
from
'
@/api/settings
'
import
{
fetchDescription
,
fetchSettings
,
removeSettings
,
updateSettings
,
uploadMedia
}
from
'
@/api/settings
'
import
{
parseNonTuples
,
parseTuples
,
partialUpdate
,
valueHasTuples
,
wrapUpdatedSettings
}
from
'
./normalizers
'
const
settings
=
{
...
...
@@ -27,9 +27,6 @@ const settings = {
CLEAR_UPDATED_SETTINGS
:
(
state
)
=>
{
state
.
updatedSettings
=
{}
},
REWRITE_CONFIG
:
(
state
,
{
tab
,
data
})
=>
{
state
.
settings
[
tab
]
=
data
},
SET_DESCRIPTION
:
(
state
,
data
)
=>
{
state
.
description
=
data
},
...
...
@@ -69,8 +66,8 @@ const settings = {
commit
(
'
SET_SETTINGS
'
,
response
.
data
.
configs
)
commit
(
'
SET_LOADING
'
,
false
)
},
RewriteConfig
({
commit
},
{
tab
,
data
}
)
{
commit
(
'
REWRITE_CONFIG
'
,
{
tab
,
data
}
)
async
RemoveSetting
({
getters
},
configs
)
{
await
removeSettings
(
configs
,
getters
.
authHost
,
getters
.
token
)
},
async
SubmitChanges
({
getters
,
commit
,
state
})
{
const
updatedData
=
Object
.
keys
(
state
.
updatedSettings
).
reduce
((
acc
,
group
)
=>
{
...
...
@@ -103,7 +100,14 @@ const settings = {
?
commit
(
'
UPDATE_SETTINGS
'
,
{
group
,
key
,
input
,
value
,
type
})
:
commit
(
'
UPDATE_SETTINGS
'
,
{
group
,
key
:
input
,
input
:
'
_value
'
,
value
,
type
})
},
UpdateState
({
commit
},
{
group
,
key
,
input
,
value
})
{
UpdateState
({
commit
,
dispatch
,
state
},
{
group
,
key
,
input
,
value
})
{
if
(
key
===
'
Pleroma.Emails.Mailer
'
&&
input
===
'
:adapter
'
)
{
const
subkeys
=
Object
.
keys
(
state
.
settings
[
group
][
key
]).
filter
(
el
=>
el
!==
'
:adapter
'
)
const
emailsValue
=
subkeys
.
map
(
el
=>
{
return
{
'
tuple
'
:
[
el
,
state
.
settings
[
group
][
key
][
el
]]
}
})
dispatch
(
'
RemoveSetting
'
,
[{
group
,
key
,
value
:
emailsValue
,
delete
:
true
,
subkeys
}])
}
key
?
commit
(
'
UPDATE_STATE
'
,
{
group
,
key
,
input
,
value
})
:
commit
(
'
UPDATE_STATE
'
,
{
group
,
key
:
input
,
input
:
'
value
'
,
value
})
...
...
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