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
pleroma
Commits
7c475349
Commit
7c475349
authored
Apr 07, 2018
by
eal
Browse files
MastoAPI: Persist frontend timelines and settings.
parent
d41bfd1d
Pipeline
#1120
passed with stage
in 3 minutes and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
7c475349
...
...
@@ -603,7 +603,7 @@ def index(%{assigns: %{user: user}} = conn, _params) do
"video\/mp4"
]
},
settings:
%{
settings:
Map
.
get
(
user
.
info
,
"settings"
)
||
%{
onboarded:
true
,
home:
%{
shows:
%{
...
...
@@ -648,6 +648,18 @@ def index(%{assigns: %{user: user}} = conn, _params) do
end
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
conn
|>
json
(%{})
else
e
->
conn
|>
json
(%{
error:
inspect
(
e
)})
end
end
def
login
(
conn
,
_
)
do
conn
|>
render
(
MastodonView
,
"login.html"
,
%{
error:
false
})
...
...
lib/pleroma/web/router.ex
View file @
7c475349
...
...
@@ -120,6 +120,12 @@ def user_fetcher(username) do
post
(
"/media"
,
MastodonAPIController
,
:upload
)
end
scope
"/api/web"
,
Pleroma
.
Web
.
MastodonAPI
do
pipe_through
(
:authenticated_api
)
put
(
"/settings"
,
MastodonAPIController
,
:put_settings
)
end
scope
"/api/v1"
,
Pleroma
.
Web
.
MastodonAPI
do
pipe_through
(
:api
)
get
(
"/instance"
,
MastodonAPIController
,
:masto_instance
)
...
...
Write
Preview
Supports
Markdown
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