2020-06-21 13:51:08 +00:00
|
|
|
|
using NodaTime;
|
|
|
|
|
|
|
|
|
|
namespace PluralKit.Core
|
2020-06-18 15:08:36 +00:00
|
|
|
|
{
|
|
|
|
|
public static class ModelExtensions
|
|
|
|
|
{
|
2020-06-21 13:51:08 +00:00
|
|
|
|
public static string DescriptionFor(this PKSystem system, LookupContext ctx) =>
|
|
|
|
|
system.DescriptionPrivacy.Get(ctx, system.Description);
|
|
|
|
|
|
|
|
|
|
public static string NameFor(this PKMember member, LookupContext ctx) =>
|
|
|
|
|
member.NamePrivacy.Get(ctx, member.Name, member.DisplayName ?? member.Name);
|
2020-06-20 14:00:50 +00:00
|
|
|
|
|
|
|
|
|
public static string AvatarFor(this PKMember member, LookupContext ctx) =>
|
2020-06-21 13:51:08 +00:00
|
|
|
|
member.AvatarPrivacy.Get(ctx, member.AvatarUrl);
|
|
|
|
|
|
|
|
|
|
public static string DescriptionFor(this PKMember member, LookupContext ctx) =>
|
|
|
|
|
member.DescriptionPrivacy.Get(ctx, member.Description);
|
|
|
|
|
|
|
|
|
|
public static LocalDate? BirthdayFor(this PKMember member, LookupContext ctx) =>
|
|
|
|
|
member.BirthdayPrivacy.Get(ctx, member.Birthday);
|
|
|
|
|
|
|
|
|
|
public static string PronounsFor(this PKMember member, LookupContext ctx) =>
|
|
|
|
|
member.PronounPrivacy.Get(ctx, member.Pronouns);
|
|
|
|
|
|
|
|
|
|
public static Instant? CreatedFor(this PKMember member, LookupContext ctx) =>
|
|
|
|
|
member.MetadataPrivacy.Get(ctx, (Instant?) member.Created);
|
|
|
|
|
|
|
|
|
|
public static int MessageCountFor(this PKMember member, LookupContext ctx) =>
|
|
|
|
|
member.MetadataPrivacy.Get(ctx, member.MessageCount);
|
2020-07-18 11:53:02 +00:00
|
|
|
|
|
|
|
|
|
public static string DescriptionFor(this PKGroup group, LookupContext ctx) =>
|
|
|
|
|
group.DescriptionPrivacy.Get(ctx, group.Description);
|
|
|
|
|
|
|
|
|
|
public static string IconFor(this PKGroup group, LookupContext ctx) =>
|
|
|
|
|
group.IconPrivacy.Get(ctx, group.Icon);
|
2020-06-18 15:08:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|