Merge branch 'status-store-content-type-' into 'develop'

Store status content mime type in the object

See merge request soapbox-pub/soapbox-be!109
This commit is contained in:
Alex Gleason 2022-03-13 19:52:45 +00:00
commit 6e0c349936
5 changed files with 12 additions and 3 deletions

View file

@ -21,7 +21,8 @@ defmodule Pleroma.Constants do
"pleroma_internal",
"generator",
"assigned_account",
"rules"
"rules",
"content_type"
]
)

View file

@ -216,6 +216,11 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do
nullable: true,
description:
"A datetime (ISO 8601) that states when the post was pinned or `null` if the post is not pinned"
},
content_type: %Schema{
type: :string,
nullable: true,
description: "A MIME type of the status"
}
}
},

View file

@ -260,6 +260,7 @@ defp object(draft) do
|> Map.put("emoji", emoji)
|> Map.put("source", draft.status)
|> Map.put("generator", draft.params[:generator])
|> Map.put("content_type", draft.params[:content_type])
%__MODULE__{draft | object: object}
end

View file

@ -415,7 +415,8 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
thread_muted: thread_muted?,
emoji_reactions: emoji_reactions,
parent_visible: visible_for_user?(reply_to, opts[:for]),
pinned_at: pinned_at
pinned_at: pinned_at,
content_type: opts[:with_source] && (object.data["content_type"] || "text/plain")
}
}
end

View file

@ -291,7 +291,8 @@ test "a note activity" do
thread_muted: false,
emoji_reactions: [],
parent_visible: false,
pinned_at: nil
pinned_at: nil,
content_type: nil
}
}