summaryrefslogtreecommitdiff
path: root/test/user_test.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-07-06 12:07:56 +0200
committerlain <lain@soykaf.club>2020-07-06 12:07:56 +0200
commited4f9f6a29d8cf2dd31e41bae7e63aaa15bc9548 (patch)
tree82c5e8b4a40495485533b9c95668cef39ce909d2 /test/user_test.exs
parenta5bbfa21a1fabe97bfff1cc80348d2944319f3ad (diff)
parent69f0b286f7b3e0518ac7ae54dfb06539dc179698 (diff)
downloadpleroma-ed4f9f6a29d8cf2dd31e41bae7e63aaa15bc9548.tar.gz
pleroma-ed4f9f6a29d8cf2dd31e41bae7e63aaa15bc9548.zip
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into 1507-static-fe-prioritize-json
Diffstat (limited to 'test/user_test.exs')
-rw-r--r--test/user_test.exs25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/user_test.exs b/test/user_test.exs
index 9b66f3f51..7126bb539 100644
--- a/test/user_test.exs
+++ b/test/user_test.exs
@@ -597,6 +597,31 @@ defmodule Pleroma.UserTest do
refute user.last_refreshed_at == orig_user.last_refreshed_at
end
+ test "if nicknames clash, the old user gets a prefix with the old id to the nickname" do
+ a_week_ago = NaiveDateTime.add(NaiveDateTime.utc_now(), -604_800)
+
+ orig_user =
+ insert(
+ :user,
+ local: false,
+ nickname: "admin@mastodon.example.org",
+ ap_id: "http://mastodon.example.org/users/harinezumigari",
+ last_refreshed_at: a_week_ago
+ )
+
+ assert orig_user.last_refreshed_at == a_week_ago
+
+ {:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/users/admin")
+
+ assert user.inbox
+
+ refute user.id == orig_user.id
+
+ orig_user = User.get_by_id(orig_user.id)
+
+ assert orig_user.nickname == "#{orig_user.id}.admin@mastodon.example.org"
+ end
+
@tag capture_log: true
test "it returns the old user if stale, but unfetchable" do
a_week_ago = NaiveDateTime.add(NaiveDateTime.utc_now(), -604_800)