- Mastodon API: `pleroma.thread_muted` to the Status entity
- Mastodon API: Mark the direct conversation as read for the author when they send a new direct message
- Mastodon API, streaming: Add `pleroma.direct_conversation_id` to the `conversation` stream event payload.
+- Admin API: Render whole status in grouped reports
</details>
### Added
reports = get_reports_by_status_id(activity["id"])
max_date = Enum.max_by(reports, &NaiveDateTime.from_iso8601!(&1.data["published"]))
actors = Enum.map(reports, & &1.user_actor)
+ {deleted, status} = get_status_data(activity)
%{
date: max_date.data["published"],
account: activity["actor"],
- status: %{
- id: activity["id"],
- content: activity["content"],
- published: activity["published"]
- },
+ status: status,
+ status_deleted: deleted,
actors: Enum.uniq(actors),
reports: reports
}
end
+ defp get_status_data(activity) do
+ case Activity.get_by_ap_id(activity["id"]) do
+ %Activity{} = act ->
+ {false, act}
+
+ _ ->
+ {true,
+ %{
+ id: activity["id"],
+ content: activity["content"],
+ published: activity["published"]
+ }}
+ end
+ end
+
def get_reports_by_status_id(ap_id) do
from(a in Activity,
where: fragment("(?)->>'type' = 'Flag'", a.data),
def render("index_grouped.json", %{groups: groups}) do
reports =
Enum.map(groups, fn group ->
+ status =
+ if group[:status_deleted],
+ do: group[:status],
+ else: StatusView.render("show.json", %{activity: group[:status]})
+
%{
date: group[:date],
account: group[:account],
- status: group[:status],
+ status: status,
+ status_deleted: status_deleted,
actors: Enum.map(group[:actors], &merge_account_views/1),
reports:
group[:reports]
alias Pleroma.UserInviteToken
alias Pleroma.Web.ActivityPub.Relay
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.MastodonAPI.StatusView
alias Pleroma.Web.MediaProxy
import Pleroma.Factory
assert length(response["reports"]) == 3
- first_group =
- Enum.find(response["reports"], &(&1["status"]["id"] == first_status.data["id"]))
+ first_group = Enum.find(response["reports"], &(&1["status"]["id"] == first_status.id))
- second_group =
- Enum.find(response["reports"], &(&1["status"]["id"] == second_status.data["id"]))
+ second_group = Enum.find(response["reports"], &(&1["status"]["id"] == second_status.id))
- third_group =
- Enum.find(response["reports"], &(&1["status"]["id"] == third_status.data["id"]))
+ third_group = Enum.find(response["reports"], &(&1["status"]["id"] == third_status.id))
assert length(first_group["reports"]) == 3
assert length(second_group["reports"]) == 2
NaiveDateTime.from_iso8601!(act.data["published"])
end).data["published"]
- assert first_group["status"] == %{
- "id" => first_status.data["id"],
- "content" => first_status.object.data["content"],
- "published" => first_status.object.data["published"]
- }
+ assert first_group["status"] == StatusView.render("show.json", %{activity: first_status})
assert first_group["account"]["id"] == target_user.id