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
eec6a87d
Commit
eec6a87d
authored
Feb 20, 2018
by
lain
Browse files
Allow moderators to delete posts.
parent
5bc810c4
Pipeline
#767
passed with stage
in 2 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/common_api/common_api.ex
View file @
eec6a87d
...
...
@@ -8,7 +8,7 @@ defmodule Pleroma.Web.CommonAPI do
def
delete
(
activity_id
,
user
)
do
with
%
Activity
{
data:
%{
"object"
=>
%{
"id"
=>
object_id
}}}
<-
Repo
.
get
(
Activity
,
activity_id
),
%
Object
{}
=
object
<-
Object
.
get_by_ap_id
(
object_id
),
true
<-
user
.
ap_id
==
object
.
data
[
"actor"
],
true
<-
user
.
info
[
"is_moderator"
]
||
(
user
.
ap_id
==
object
.
data
[
"actor"
]
)
,
{
:ok
,
delete
}
<-
ActivityPub
.
delete
(
object
)
do
{
:ok
,
delete
}
end
...
...
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