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
les
gancio
Commits
9e285d8b
Verified
Commit
9e285d8b
authored
Jun 25, 2021
by
les
Browse files
fix AP resource removal
parent
cd313ef1
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/federation/resources.js
View file @
9e285d8b
...
...
@@ -59,7 +59,7 @@ module.exports = {
async
remove
(
req
,
res
)
{
const
resource
=
await
Resource
.
findOne
({
where
:
{
activitypub_id
:
req
.
body
.
object
.
id
},
include
:
[{
model
:
APUser
,
required
:
fals
e
,
attributes
:
[
'
ap_id
'
]
}]
include
:
[{
model
:
APUser
,
required
:
tru
e
,
attributes
:
[
'
ap_id
'
]
}]
})
if
(
!
resource
)
{
log
.
info
(
`Comment
${
req
.
body
.
object
.
id
}
not found`
)
...
...
@@ -67,8 +67,7 @@ module.exports = {
}
// check if fedi_user that requested resource removal
// is the same that created the resource at first place
log
.
debug
(
res
.
fedi_user
.
ap_id
,
resource
.
ap_user
.
ap_id
)
if
(
res
.
fedi_user
.
ap_id
===
resource
.
ap_user
.
id
)
{
if
(
req
.
fedi_user
.
ap_id
===
resource
.
ap_user
.
id
)
{
await
resource
.
destroy
()
log
.
info
(
`Comment
${
req
.
body
.
object
.
id
}
removed`
)
res
.
sendStatus
(
201
)
...
...
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