Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hakaba Hitoyo
pleroma
Commits
da64ea4a
Commit
da64ea4a
authored
Sep 02, 2018
by
vaartis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement mastodon mutes endpoint
Aparently i forgot to add it, it gets a list of muted users
parent
f41f017b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+9
-0
lib/pleroma/web/router.ex
lib/pleroma/web/router.ex
+1
-1
No files found.
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
da64ea4a
...
@@ -780,6 +780,15 @@ def unmute(%{assigns: %{user: muter}} = conn, %{"id" => id}) do
...
@@ -780,6 +780,15 @@ def unmute(%{assigns: %{user: muter}} = conn, %{"id" => id}) do
end
end
end
end
# TODO: Use proper query
def
mutes
(%{
assigns:
%{
user:
user
}}
=
conn
,
_
)
do
with
muted_users
<-
user
.
info
[
"mutes"
]
||
[],
accounts
<-
Enum
.
map
(
muted_users
,
fn
ap_id
->
User
.
get_cached_by_ap_id
(
ap_id
)
end
)
do
res
=
AccountView
.
render
(
"accounts.json"
,
users:
accounts
,
for:
user
,
as:
:user
)
json
(
conn
,
res
)
end
end
def
block
(%{
assigns:
%{
user:
blocker
}}
=
conn
,
%{
"id"
=>
id
})
do
def
block
(%{
assigns:
%{
user:
blocker
}}
=
conn
,
%{
"id"
=>
id
})
do
with
%
User
{}
=
blocked
<-
Repo
.
get
(
User
,
id
),
with
%
User
{}
=
blocked
<-
Repo
.
get
(
User
,
id
),
{
:ok
,
blocker
}
<-
User
.
block
(
blocker
,
blocked
),
{
:ok
,
blocker
}
<-
User
.
block
(
blocker
,
blocked
),
...
...
lib/pleroma/web/router.ex
View file @
da64ea4a
...
@@ -178,7 +178,7 @@ defmodule Pleroma.Web.Router do
...
@@ -178,7 +178,7 @@ defmodule Pleroma.Web.Router do
get
(
"/blocks"
,
MastodonAPIController
,
:blocks
)
get
(
"/blocks"
,
MastodonAPIController
,
:blocks
)
get
(
"/mutes"
,
MastodonAPIController
,
:
empty_array
)
get
(
"/mutes"
,
MastodonAPIController
,
:
mutes
)
get
(
"/timelines/home"
,
MastodonAPIController
,
:home_timeline
)
get
(
"/timelines/home"
,
MastodonAPIController
,
:home_timeline
)
...
...
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