Instead of checking string length, explicitly check for "" and "."

This commit is contained in:
Ekaterina Vaartis 2022-08-27 00:09:37 +03:00
parent e20f74c71b
commit 119b2b847b

View File

@ -112,7 +112,7 @@ defmodule Pleroma.Search.Meilisearch do
not is_nil(object.data["content"]) and not is_nil(object.data["content"]) and
(Pleroma.Constants.as_public() in object.data["to"] or (Pleroma.Constants.as_public() in object.data["to"] or
Pleroma.Constants.as_public() in object.data["cc"]) and Pleroma.Constants.as_public() in object.data["cc"]) and
String.length(object.data["content"]) > 1 do object.data["content"] not in ["", "."] do
data = object.data data = object.data
content_str = content_str =
@ -127,7 +127,8 @@ defmodule Pleroma.Search.Meilisearch do
trimmed trimmed
end end
if String.length(content) > 1 do # Make sure we have a non-empty string
if content != "" do
{:ok, published, _} = DateTime.from_iso8601(data["published"]) {:ok, published, _} = DateTime.from_iso8601(data["published"])
%{ %{