Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
2ae1128d
Commit
2ae1128d
authored
Dec 06, 2018
by
rinpatch
Browse files
MastoAPI: Fix put_settings
parent
ccf0b46d
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
2ae1128d
...
...
@@ -62,10 +62,6 @@ def follow_changeset(struct, params \\ %{}) do
|>
validate_required
([
:following
])
end
def
info_changeset
(
struct
,
params
\\
%{})
do
raise
"NOT VALID ANYMORE"
end
def
user_info
(%
User
{}
=
user
)
do
oneself
=
if
user
.
local
,
do
:
1
,
else
:
0
...
...
lib/pleroma/user/info.ex
View file @
2ae1128d
...
...
@@ -149,6 +149,11 @@ def mastodon_profile_update(info, params) do
])
end
def
mastodon_settings_update
(
info
,
params
)
do
info
|>
cast
(
params
,
[
:settings
])
end
def
set_source_data
(
info
,
source_data
)
do
params
=
%{
source_data:
source_data
}
...
...
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
2ae1128d
...
...
@@ -970,9 +970,11 @@ def index(%{assigns: %{user: user}} = conn, _params) do
end
def
put_settings
(%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"data"
=>
settings
}
=
_params
)
do
with
new_info
<-
Map
.
put
(
user
.
info
,
"settings"
,
settings
),
change
<-
User
.
info_changeset
(
user
,
%{
info:
new_info
}),
{
:ok
,
_user
}
<-
User
.
update_and_set_cache
(
change
)
do
info_cng
=
User
.
Info
.
mastodon_settings_update
(
user
.
info
,
settings
)
with
changeset
<-
User
.
update_changeset
(
user
),
changeset
<-
Ecto
.
Changeset
.
put_embed
(
changeset
,
:info
,
info_cng
),
{
:ok
,
user
}
<-
User
.
update_and_set_cache
(
changeset
)
do
conn
|>
json
(%{})
else
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment