1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 03:22:54 +08:00

Check if a user exists before creating new user

This commit is contained in:
David Zhao 2019-02-25 13:58:19 +09:00
parent 809ab86ed0
commit 8da671fa6c

View File

@ -109,15 +109,27 @@ namespace osu.Game.Scoring
public string UserString public string UserString
{ {
get => User?.Username; get => User?.Username;
set => User = new User { Username = value, Id = UserID}; set
{
if (User == null)
User = new User { Username = value, Id = UserID };
else
User.Username = value;
}
} }
[JsonIgnore] [JsonIgnore]
[Column("UserID")] [Column("UserID")]
public long UserID public long UserID
{ {
get => User?.Id ?? 1; get => User.Id;
set => User = new User {Username = UserString, Id = value}; set
{
if (User == null)
User = new User { Username = UserString, Id = value };
else
User.Id = value;
}
} }
[JsonIgnore] [JsonIgnore]