aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaniini <ariadne@dereferenced.org>2019-07-20 13:09:38 +0000
committerkaniini <ariadne@dereferenced.org>2019-07-20 13:09:38 +0000
commitfe548f322e834c7c81678a460c54c71f1198021c (patch)
tree08ae6a155f7b161f64768d16246a9890fb84ac25
parent6e99e7c774d5e8b6e881810c506cfd9dce2a6107 (diff)
parentd0198fe215a7542ce506e40e1e4860a27ee2d01e (diff)
downloadpleroma-fe548f322e834c7c81678a460c54c71f1198021c.tar.gz
Merge branch '1112-user-insert-conflict-id-preservation' into 'develop'
[#1112] Preserving `id` on user insert conflict Closes #1112 See merge request pleroma/pleroma!1456
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/pleroma/user.ex2
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e79b5420..f60f3ed97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Mastodon API: Embedded relationships not being properly rendered in the Account entity of Status entity
- Mastodon API: Add `account_id`, `type`, `offset`, and `limit` to search API (`/api/v1/search` and `/api/v2/search`)
- ActivityPub C2S: follower/following collection pages being inaccessible even when authentifucated if `hide_followers`/ `hide_follows` was set
+- Existing user id not being preserved on insert conflict
### Added
- MRF: Support for priming the mediaproxy cache (`Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy`)
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index c91fbb68a..5ea2b518b 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -1211,7 +1211,7 @@ defmodule Pleroma.User do
data
|> Map.put(:name, blank?(data[:name]) || data[:nickname])
|> remote_user_creation()
- |> Repo.insert(on_conflict: :replace_all, conflict_target: :nickname)
+ |> Repo.insert(on_conflict: :replace_all_except_primary_key, conflict_target: :nickname)
|> set_cache()
end