aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhref <href@random.sh>2019-01-26 16:58:23 +0100
committerhref <href@random.sh>2019-01-26 16:58:23 +0100
commitd6015338c8fea62602e969a498b80c2a5b754909 (patch)
treef2356913c85880acf9801ed17152ea283f4a2e31 /lib
parent6383fa3a5d1a269315001b445dafc73a059dd8cb (diff)
downloadpleroma-d6015338c8fea62602e969a498b80c2a5b754909.tar.gz
Flake: support integers in from_string/1
Some previously issued stateless tokens have integer ids in them.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/flake_id.ex4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pleroma/flake_id.ex b/lib/pleroma/flake_id.ex
index 26399ae05..69482f69a 100644
--- a/lib/pleroma/flake_id.ex
+++ b/lib/pleroma/flake_id.ex
@@ -33,6 +33,10 @@ defmodule Pleroma.FlakeId do
def to_string(s), do: s
+ def from_string(int) when is_integer(int) do
+ from_string(Kernel.to_string(int))
+ end
+
for i <- [-1, 0] do
def from_string(unquote(i)), do: <<0::integer-size(128)>>
def from_string(unquote(Kernel.to_string(i))), do: <<0::integer-size(128)>>