diff --git a/Pleroma/Models/Account.cs b/Pleroma/Models/Account.cs index 4689ccc..8ce75d4 100644 --- a/Pleroma/Models/Account.cs +++ b/Pleroma/Models/Account.cs @@ -71,7 +71,11 @@ public readonly struct AccountID(string id) { public static implicit operator AccountID(string id) => new AccountID(id); + public static implicit operator AccountID?(string? id) => id == null ? new AccountID?() : new AccountID(id); + public static implicit operator AccountID(Account account) => new AccountID(account.ID); + + public static implicit operator AccountID?(Account? account) => account == null ? new AccountID?() : new AccountID(account.ID); public static implicit operator AccountID(Relationship relationship) => new AccountID(relationship.ID); diff --git a/Pleroma/Models/Status.cs b/Pleroma/Models/Status.cs index 90f9883..d0c61f1 100644 --- a/Pleroma/Models/Status.cs +++ b/Pleroma/Models/Status.cs @@ -222,8 +222,12 @@ public readonly struct StatusID(string id) : IEquatable { public static implicit operator StatusID(string id) => new StatusID(id); + public static implicit operator StatusID?(string? id) => id == null ? new StatusID?() : new StatusID(id); + public static implicit operator StatusID(Status status) => new StatusID(status.ID); + public static implicit operator StatusID?(Status? status) => status == null ? new StatusID?() : new StatusID(status.ID); + public readonly string ID = id; public override string ToString() => ID;