Merge branch 'application-to-generator' into 'develop'
ActvitityStreams application field should be called "generator" See merge request pleroma/pleroma!3352
This commit is contained in:
commit
d03ee11b72
@ -19,7 +19,7 @@ defmodule Pleroma.Constants do
|
|||||||
"context_id",
|
"context_id",
|
||||||
"deleted_activity_id",
|
"deleted_activity_id",
|
||||||
"pleroma_internal",
|
"pleroma_internal",
|
||||||
"application"
|
"generator"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ defp object(draft) do
|
|||||||
Utils.make_note_data(draft)
|
Utils.make_note_data(draft)
|
||||||
|> Map.put("emoji", emoji)
|
|> Map.put("emoji", emoji)
|
||||||
|> Map.put("source", draft.status)
|
|> Map.put("source", draft.status)
|
||||||
|> Map.put("application", draft.params[:application])
|
|> Map.put("generator", draft.params[:generator])
|
||||||
|
|
||||||
%__MODULE__{draft | object: object}
|
%__MODULE__{draft | object: object}
|
||||||
end
|
end
|
||||||
|
@ -423,11 +423,11 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do
|
|||||||
defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do
|
defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do
|
||||||
if user.disclose_client do
|
if user.disclose_client do
|
||||||
%{client_name: client_name, website: website} = Repo.preload(token, :app).app
|
%{client_name: client_name, website: website} = Repo.preload(token, :app).app
|
||||||
Map.put(params, :application, %{type: "Application", name: client_name, url: website})
|
Map.put(params, :generator, %{type: "Application", name: client_name, url: website})
|
||||||
else
|
else
|
||||||
Map.put(params, :application, nil)
|
Map.put(params, :generator, nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp put_application(params, _), do: Map.put(params, :application, nil)
|
defp put_application(params, _), do: Map.put(params, :generator, nil)
|
||||||
end
|
end
|
||||||
|
@ -180,7 +180,7 @@ def render(
|
|||||||
media_attachments: reblogged[:media_attachments] || [],
|
media_attachments: reblogged[:media_attachments] || [],
|
||||||
mentions: mentions,
|
mentions: mentions,
|
||||||
tags: reblogged[:tags] || [],
|
tags: reblogged[:tags] || [],
|
||||||
application: build_application(activity_object.data["application"]),
|
application: build_application(activity_object.data["generator"]),
|
||||||
language: nil,
|
language: nil,
|
||||||
emojis: [],
|
emojis: [],
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
@ -345,7 +345,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
|
|||||||
poll: render(PollView, "show.json", object: object, for: opts[:for]),
|
poll: render(PollView, "show.json", object: object, for: opts[:for]),
|
||||||
mentions: mentions,
|
mentions: mentions,
|
||||||
tags: build_tags(tags),
|
tags: build_tags(tags),
|
||||||
application: build_application(object.data["application"]),
|
application: build_application(object.data["generator"]),
|
||||||
language: nil,
|
language: nil,
|
||||||
emojis: build_emojis(object.data["emoji"]),
|
emojis: build_emojis(object.data["emoji"]),
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
@ -205,7 +205,7 @@ test "it strips internal fields" do
|
|||||||
{:ok, activity} =
|
{:ok, activity} =
|
||||||
CommonAPI.post(user, %{
|
CommonAPI.post(user, %{
|
||||||
status: "#2hu :firefox:",
|
status: "#2hu :firefox:",
|
||||||
application: %{type: "Application", name: "TestClient", url: "https://pleroma.social"}
|
generator: %{type: "Application", name: "TestClient", url: "https://pleroma.social"}
|
||||||
})
|
})
|
||||||
|
|
||||||
# Ensure injected application data made it into the activity
|
# Ensure injected application data made it into the activity
|
||||||
@ -215,7 +215,7 @@ test "it strips internal fields" do
|
|||||||
type: "Application",
|
type: "Application",
|
||||||
name: "TestClient",
|
name: "TestClient",
|
||||||
url: "https://pleroma.social"
|
url: "https://pleroma.social"
|
||||||
} == activity.object.data["application"]
|
} == activity.object.data["generator"]
|
||||||
|
|
||||||
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ test "it strips internal fields" do
|
|||||||
assert is_nil(modified["object"]["announcements"])
|
assert is_nil(modified["object"]["announcements"])
|
||||||
assert is_nil(modified["object"]["announcement_count"])
|
assert is_nil(modified["object"]["announcement_count"])
|
||||||
assert is_nil(modified["object"]["context_id"])
|
assert is_nil(modified["object"]["context_id"])
|
||||||
assert is_nil(modified["object"]["application"])
|
assert is_nil(modified["object"]["generator"])
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it strips internal fields of article" do
|
test "it strips internal fields of article" do
|
||||||
|
Loading…
Reference in New Issue
Block a user