Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
mastofe
Commits
9005075b
Verified
Commit
9005075b
authored
Jun 30, 2020
by
Haelwenn
Browse files
initial_state: sync notifications.shows with pleroma notification_settings
parent
cfefd0ae
Pipeline
#27860
passed with stage
in 4 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/javascript/flavours/glitch/actions/settings.js
View file @
9005075b
...
...
@@ -25,7 +25,10 @@ const debouncedSave = debounce((dispatch, getState) => {
const
data
=
getState
().
get
(
'
settings
'
).
filter
((
_
,
path
)
=>
path
!==
'
saved
'
).
toJS
();
api
(
getState
).
put
(
'
/api/pleroma/notification_settings
'
,
{
exclude_types
:
excludeTypesFromSettings
(
getState
())
});
api
(
getState
).
put
(
'
/api/pleroma/notification_settings
'
,
{
exclude_types
:
excludeTypesFromSettings
(
getState
())
}
).
catch
(
error
=>
dispatch
(
showAlertForError
(
error
)));
api
(
getState
).
put
(
'
/api/web/settings
'
,
{
data
})
.
then
(()
=>
dispatch
({
type
:
SETTING_SAVE
}))
...
...
app/javascript/flavours/glitch/util/initial_state.js
View file @
9005075b
...
...
@@ -6,6 +6,23 @@ const initialState = element && function () {
}
catch
(
e
)
{
result
.
local_settings
=
{};
}
const
res_me
=
result
.
meta
&&
result
.
meta
[
'
me
'
];
const
res_my_acct
=
res_me
&&
result
.
accounts
&&
result
.
accounts
[
res_me
];
const
notification_settings
=
res_my_acct
&&
res_my_acct
[
'
pleroma
'
]
&&
res_my_acct
[
'
pleroma
'
][
'
notification_settings
'
];
if
(
notification_settings
&&
notification_settings
[
'
exclude_types
'
]
&&
result
[
'
settings
'
][
'
notifications
'
]
)
{
var
show_types
=
result
[
'
settings
'
][
'
notifications
'
][
'
shows
'
]
?
result
[
'
settings
'
][
'
notifications
'
][
'
shows
'
]
:
{};
notification_settings
[
'
exclude_types
'
].
forEach
(
x
=>
show_types
[
x
]
=
false
);
result
[
'
settings
'
][
'
notifications
'
][
'
shows
'
]
=
show_types
;
}
return
result
;
}();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment