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
7efc074e
Commit
7efc074e
authored
Nov 02, 2020
by
feld
Browse files
Permit fetching individual reports with notes preloaded
parent
24ce3249
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/activity.ex
View file @
7efc074e
...
...
@@ -14,6 +14,7 @@ defmodule Pleroma.Activity do
alias
Pleroma
.
ReportNote
alias
Pleroma
.
ThreadMute
alias
Pleroma
.
User
alias
Pleroma
.
Web
.
ActivityPub
.
ActivityPub
import
Ecto
.
Changeset
import
Ecto
.
Query
...
...
@@ -153,6 +154,18 @@ def get_bookmark(%Activity{} = activity, %User{} = user) do
def
get_bookmark
(
_
,
_
),
do
:
nil
def
get_report
(
activity_id
)
do
opts
=
%{
type:
"Flag"
,
skip_preload:
true
,
preload_report_notes:
true
}
ActivityPub
.
fetch_activities_query
([],
opts
)
|>
where
(
id:
^
activity_id
)
|>
Repo
.
one
()
end
def
change
(
struct
,
params
\\
%{})
do
struct
|>
cast
(
params
,
[
:data
,
:recipients
])
...
...
lib/pleroma/web/admin_api/controllers/report_controller.ex
View file @
7efc074e
...
...
@@ -38,7 +38,7 @@ def index(conn, params) do
end
def
show
(
conn
,
%{
id:
id
})
do
with
%
Activity
{}
=
report
<-
Activity
.
get_
by_id
(
id
)
do
with
%
Activity
{}
=
report
<-
Activity
.
get_
report
(
id
)
do
render
(
conn
,
"show.json"
,
Report
.
extract_report_info
(
report
))
else
_
->
{
:error
,
:not_found
}
...
...
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