mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Move most references to PKMember.Name to go through helper extepsions for privacy
This commit is contained in:
parent
761270f0c3
commit
56eae82b0a
22 changed files with 97 additions and 62 deletions
|
|
@ -20,5 +20,7 @@
|
|||
public static bool operator !=(MemberId left, MemberId right) => !left.Equals(right);
|
||||
|
||||
public int CompareTo(MemberId other) => Value.CompareTo(other.Value);
|
||||
|
||||
public override string ToString() => $"Member #{Value}";
|
||||
}
|
||||
}
|
||||
8
PluralKit.Core/Models/ModelExtensions.cs
Normal file
8
PluralKit.Core/Models/ModelExtensions.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace PluralKit.Core
|
||||
{
|
||||
public static class ModelExtensions
|
||||
{
|
||||
public static string NameFor(this PKMember member, LookupContext ctx) =>
|
||||
member.NamePrivacy.CanAccess(ctx) ? member.Name : member.DisplayName ?? member.Name;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,5 +20,7 @@
|
|||
public static bool operator !=(SwitchId left, SwitchId right) => !left.Equals(right);
|
||||
|
||||
public int CompareTo(SwitchId other) => Value.CompareTo(other.Value);
|
||||
|
||||
public override string ToString() => $"Switch #{Value}";
|
||||
}
|
||||
}
|
||||
|
|
@ -20,5 +20,7 @@
|
|||
public static bool operator !=(SystemId left, SystemId right) => !left.Equals(right);
|
||||
|
||||
public int CompareTo(SystemId other) => Value.CompareTo(other.Value);
|
||||
|
||||
public override string ToString() => $"System #{Value}";
|
||||
}
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ namespace PluralKit.Core
|
|||
|
||||
// Otherwise, write to importer
|
||||
await importer.StartRowAsync();
|
||||
await importer.WriteAsync(_systemId, NpgsqlDbType.Integer);
|
||||
await importer.WriteAsync(_systemId.Value, NpgsqlDbType.Integer);
|
||||
await importer.WriteAsync(sw.Timestamp, NpgsqlDbType.Timestamp);
|
||||
|
||||
// Note that we've imported a switch with this timestamp
|
||||
|
|
@ -170,8 +170,8 @@ namespace PluralKit.Core
|
|||
throw new Exception($"Attempted to import switch with member identifier {memberIdentifier} but could not find an entry in the id map for this! :/");
|
||||
|
||||
await importer.StartRowAsync();
|
||||
await importer.WriteAsync(justAddedSwitch.Id, NpgsqlDbType.Integer);
|
||||
await importer.WriteAsync(memberId, NpgsqlDbType.Integer);
|
||||
await importer.WriteAsync(justAddedSwitch.Id.Value, NpgsqlDbType.Integer);
|
||||
await importer.WriteAsync(memberId.Value, NpgsqlDbType.Integer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue