Mastodon makes this field null when posting with MastoFE or if you choose to not disclose it, so it's safe to be null by default

This commit is contained in:
Mark Felder 2021-02-18 16:35:03 -06:00
parent fb2a8e7ccd
commit d5ef02c7a7
4 changed files with 7 additions and 9 deletions

View File

@ -23,9 +23,10 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
application: %Schema{
description: "The application used to post this status",
type: :object,
nullable: true,
properties: %{
name: %Schema{type: :string},
website: %Schema{type: :string, nullable: true, format: :uri}
website: %Schema{type: :string, format: :uri}
}
},
bookmarked: %Schema{type: :boolean, description: "Have you bookmarked this status?"},
@ -291,7 +292,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
"url" => "http://localhost:4001/users/nick6",
"username" => "nick6"
},
"application" => %{"name" => "Web", "website" => nil},
"application" => nil,
"bookmarked" => false,
"card" => nil,
"content" => "foobar",

View File

@ -425,5 +425,5 @@ defp put_application(params, %{assigns: %{token: %Token{} = token}} = _conn) do
Map.put(params, :application, %{name: client_name, website: website})
end
defp put_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil})
defp put_application(params, _), do: Map.put(params, :application, nil)
end

View File

@ -180,7 +180,7 @@ def render(
media_attachments: reblogged[:media_attachments] || [],
mentions: mentions,
tags: reblogged[:tags] || [],
application: activity_object.data["application"] || %{name: "Web", website: nil},
application: activity_object.data["application"] || nil,
language: nil,
emojis: [],
pleroma: %{
@ -345,7 +345,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
poll: render(PollView, "show.json", object: object, for: opts[:for]),
mentions: mentions,
tags: build_tags(tags),
application: object.data["application"] || %{name: "Web", website: nil},
application: object.data["application"] || nil,
language: nil,
emojis: build_emojis(object.data["emoji"]),
pleroma: %{

View File

@ -266,10 +266,7 @@ test "a note activity" do
url: "http://localhost:4001/tag/#{object_data["tag"]}"
}
],
application: %{
name: "Web",
website: nil
},
application: nil,
language: nil,
emojis: [
%{