projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
user: Add support for custom emojis in profile fields
[akkoma]
/
lib
/
pleroma
/
instances
/
instance.ex
diff --git
a/lib/pleroma/instances/instance.ex
b/lib/pleroma/instances/instance.ex
index 4d7ed4ca1076abe35b697f2e29002f739b2124c8..74458c09aa5043ed0e491fb51eb64101f106c95f 100644
(file)
--- a/
lib/pleroma/instances/instance.ex
+++ b/
lib/pleroma/instances/instance.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Instances.Instance do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Instances.Instance do
@@
-90,7
+90,7
@@
defmodule Pleroma.Instances.Instance do
def set_unreachable(url_or_host, unreachable_since \\ nil)
def set_unreachable(url_or_host, unreachable_since) when is_binary(url_or_host) do
def set_unreachable(url_or_host, unreachable_since \\ nil)
def set_unreachable(url_or_host, unreachable_since) when is_binary(url_or_host) do
- unreachable_since =
unreachable_since ||
DateTime.utc_now()
+ unreachable_since =
parse_datetime(unreachable_since) || Naive
DateTime.utc_now()
host = host(url_or_host)
existing_record = Repo.get_by(Instance, %{host: host})
host = host(url_or_host)
existing_record = Repo.get_by(Instance, %{host: host})
@@
-114,4
+114,10
@@
defmodule Pleroma.Instances.Instance do
end
def set_unreachable(_, _), do: {:error, nil}
end
def set_unreachable(_, _), do: {:error, nil}
+
+ defp parse_datetime(datetime) when is_binary(datetime) do
+ NaiveDateTime.from_iso8601(datetime)
+ end
+
+ defp parse_datetime(datetime), do: datetime
end
end