Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into frontend-admin-api
This commit is contained in:
commit
e46c95b826
12 changed files with 66 additions and 10 deletions
|
|
@ -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 @@ defmodule Pleroma.Activity 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])
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
{:ok, notifications} = Notification.create_notifications(activity, do_send: false)
|
||||
{:ok, _user} = ActivityPub.increase_note_count_if_public(user, object)
|
||||
|
||||
if in_reply_to = object.data["inReplyTo"] do
|
||||
if in_reply_to = object.data["inReplyTo"] && object.data["type"] != "Answer" do
|
||||
Object.increase_replies_count(in_reply_to)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ defmodule Pleroma.Web.AdminAPI.ReportController 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}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,15 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
|
|||
end
|
||||
|
||||
activity = Activity.get_by_id_with_object(last_activity_id)
|
||||
# Conversations return all users except the current user.
|
||||
users = Enum.reject(participation.recipients, &(&1.id == user.id))
|
||||
|
||||
# Conversations return all users except the current user,
|
||||
# except when the current user is the only participant
|
||||
users =
|
||||
if length(participation.recipients) > 1 do
|
||||
Enum.reject(participation.recipients, &(&1.id == user.id))
|
||||
else
|
||||
participation.recipients
|
||||
end
|
||||
|
||||
%{
|
||||
id: participation.id |> to_string(),
|
||||
|
|
@ -43,7 +50,8 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
|
|||
last_status:
|
||||
render(StatusView, "show.json",
|
||||
activity: activity,
|
||||
direct_conversation_id: participation.id
|
||||
direct_conversation_id: participation.id,
|
||||
for: user
|
||||
)
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue