mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Fix inviting user that had already signed up via a different email
This commit is contained in:
parent
1b8f23eeed
commit
665219fb00
1 changed files with 9 additions and 3 deletions
|
@ -878,10 +878,16 @@ impl Database {
|
|||
let signup = signup.update(&*tx).await?;
|
||||
|
||||
if let Some(inviting_user_id) = signup.inviting_user_id {
|
||||
let (user_id_a, user_id_b, a_to_b) = if inviting_user_id < user.id {
|
||||
(inviting_user_id, user.id, true)
|
||||
} else {
|
||||
(user.id, inviting_user_id, false)
|
||||
};
|
||||
|
||||
contact::Entity::insert(contact::ActiveModel {
|
||||
user_id_a: ActiveValue::set(inviting_user_id),
|
||||
user_id_b: ActiveValue::set(user.id),
|
||||
a_to_b: ActiveValue::set(true),
|
||||
user_id_a: ActiveValue::set(user_id_a),
|
||||
user_id_b: ActiveValue::set(user_id_b),
|
||||
a_to_b: ActiveValue::set(a_to_b),
|
||||
should_notify: ActiveValue::set(true),
|
||||
accepted: ActiveValue::set(true),
|
||||
..Default::default()
|
||||
|
|
Loading…
Reference in a new issue