projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Documentation: Add warning about database mix tasks.
[akkoma]
/
lib
/
pleroma
/
instances
/
instance.ex
diff --git
a/lib/pleroma/instances/instance.ex
b/lib/pleroma/instances/instance.ex
index 420803a8fa84203c28335d0e5c198a737d0c1d20..544c4b687c8d5e0a9c13a3247fa8e731609b0188 100644
(file)
--- a/
lib/pleroma/instances/instance.ex
+++ b/
lib/pleroma/instances/instance.ex
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Instances.Instance do
@moduledoc "Instance."
defmodule Pleroma.Instances.Instance do
@moduledoc "Instance."
@@
-86,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})
@@
-110,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