diff options
author | marcin mikołajczak <git@mkljczk.pl> | 2023-08-11 14:59:58 +0200 |
---|---|---|
committer | marcin mikołajczak <git@mkljczk.pl> | 2023-08-11 14:59:58 +0200 |
commit | 366559c5a33c30de181782418cd1b52f65d0ca5a (patch) | |
tree | 1c7b24d9ac369bd2b42fe4c7636503080c675458 /lib | |
parent | 04c8f6b4d1e2a9a30f66b0ffb99d7a17a1510a3e (diff) | |
download | pleroma-366559c5a33c30de181782418cd1b52f65d0ca5a.tar.gz pleroma-366559c5a33c30de181782418cd1b52f65d0ca5a.zip |
Make status.language == nil for 'und' value
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/status_view.ex | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 50d8ebde9..2ae5e14aa 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -200,7 +200,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do mentions: mentions, tags: reblogged[:tags] || [], application: build_application(object.data["generator"]), - language: object.data["language"], + language: get_language(object), emojis: [], pleroma: %{ local: activity.local, @@ -391,7 +391,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do mentions: mentions, tags: build_tags(tags), application: build_application(object.data["generator"]), - language: object.data["language"], + language: get_language(object), emojis: build_emojis(object.data["emoji"]), pleroma: %{ local: activity.local, @@ -756,4 +756,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do defp get_source_content_type(_source) do Utils.get_content_type(nil) end + + defp get_language(%{data: %{"language" => "und"}}), do: nil + + defp get_language(object), do: object.data["language"] end |