Merge remote-tracking branch 'origin/develop' into shigusegubu
This commit is contained in:
commit
5379db3194
6 changed files with 32 additions and 37 deletions
|
|
@ -8,8 +8,6 @@ defmodule Pleroma.Activity do
|
|||
field(:local, :boolean, default: true)
|
||||
field(:actor, :string)
|
||||
field(:recipients, {:array, :string})
|
||||
field(:recipients_to, {:array, :string})
|
||||
field(:recipients_cc, {:array, :string})
|
||||
has_many(:notifications, Notification, on_delete: :delete_all)
|
||||
|
||||
timestamps()
|
||||
|
|
|
|||
|
|
@ -60,16 +60,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
:ok <- check_actor_is_active(map["actor"]),
|
||||
{:ok, map} <- MRF.filter(map),
|
||||
:ok <- insert_full_object(map) do
|
||||
{recipients, recipients_to, recipients_cc} = get_recipients(map)
|
||||
{recipients, _, _} = get_recipients(map)
|
||||
|
||||
{:ok, activity} =
|
||||
Repo.insert(%Activity{
|
||||
data: map,
|
||||
local: local,
|
||||
actor: map["actor"],
|
||||
recipients: recipients,
|
||||
recipients_to: recipients_to,
|
||||
recipients_cc: recipients_cc
|
||||
recipients: recipients
|
||||
})
|
||||
|
||||
Notification.create_notifications(activity)
|
||||
|
|
@ -415,11 +413,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
activity in query,
|
||||
where:
|
||||
fragment(
|
||||
"(? && ?) or (? && ?)",
|
||||
"(?->'to' \\?| ?) or (?->'cc' \\?| ?)",
|
||||
activity.data,
|
||||
^recipients_to,
|
||||
activity.recipients_to,
|
||||
^recipients_cc,
|
||||
activity.recipients_cc
|
||||
activity.data,
|
||||
^recipients_cc
|
||||
)
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
|
||||
%{
|
||||
id: to_string(user.id),
|
||||
username: hd(String.split(user.nickname, "@")),
|
||||
username: username_from_nickname(user.nickname),
|
||||
acct: user.nickname,
|
||||
display_name: user.name || user.nickname,
|
||||
locked: user_info.locked,
|
||||
|
|
@ -56,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
%{
|
||||
id: to_string(user.id),
|
||||
acct: user.nickname,
|
||||
username: hd(String.split(user.nickname, "@")),
|
||||
username: username_from_nickname(user.nickname),
|
||||
url: user.ap_id
|
||||
}
|
||||
end
|
||||
|
|
@ -76,4 +76,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
def render("relationships.json", %{user: user, targets: targets}) do
|
||||
render_many(targets, AccountView, "relationship.json", user: user, as: :target)
|
||||
end
|
||||
|
||||
defp username_from_nickname(string) when is_binary(string) do
|
||||
hd(String.split(string, "@"))
|
||||
end
|
||||
|
||||
defp username_from_nickname(_), do: nil
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue