mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: initial 6-character HID rework
This commit is contained in:
parent
73f43b8cb3
commit
9f56697241
30 changed files with 208 additions and 91 deletions
|
|
@ -32,7 +32,13 @@ public readonly struct GroupId: INumericId<GroupId, int>
|
|||
public class PKGroup
|
||||
{
|
||||
public GroupId Id { get; private set; }
|
||||
public string Hid { get; private set; } = null!;
|
||||
private string _hid = null!;
|
||||
public string Hid
|
||||
{
|
||||
private set => _hid = value.Trim();
|
||||
get => _hid;
|
||||
}
|
||||
|
||||
public Guid Uuid { get; private set; }
|
||||
public SystemId System { get; private set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,13 @@ public class PKMember
|
|||
// Dapper *can* figure out mapping to getter-only properties, but this doesn't work
|
||||
// when trying to map to *subclasses* (eg. ListedMember). Adding private setters makes it work anyway.
|
||||
public MemberId Id { get; private set; }
|
||||
public string Hid { get; private set; }
|
||||
private string _hid = null!;
|
||||
public string Hid
|
||||
{
|
||||
private set => _hid = value.Trim();
|
||||
get => _hid;
|
||||
}
|
||||
|
||||
public Guid Uuid { get; private set; }
|
||||
public SystemId System { get; private set; }
|
||||
public string Color { get; private set; }
|
||||
|
|
|
|||
|
|
@ -33,7 +33,13 @@ public readonly struct SystemId: INumericId<SystemId, int>
|
|||
public class PKSystem
|
||||
{
|
||||
[Key] public SystemId Id { get; }
|
||||
public string Hid { get; }
|
||||
private string _hid = null!;
|
||||
public string Hid
|
||||
{
|
||||
private set => _hid = value.Trim();
|
||||
get => _hid;
|
||||
}
|
||||
|
||||
public Guid Uuid { get; private set; }
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public class SystemConfigPatch: PatchObject
|
|||
public Partial<string[]> DescriptionTemplates { get; set; }
|
||||
public Partial<bool> CaseSensitiveProxyTags { get; set; }
|
||||
public Partial<bool> ProxyErrorMessageEnabled { get; set; }
|
||||
public Partial<bool> HidDisplaySplit { get; set; }
|
||||
|
||||
|
||||
public override Query Apply(Query q) => q.ApplyPatch(wrapper => wrapper
|
||||
|
|
@ -33,6 +34,7 @@ public class SystemConfigPatch: PatchObject
|
|||
.With("description_templates", DescriptionTemplates)
|
||||
.With("case_sensitive_proxy_tags", CaseSensitiveProxyTags)
|
||||
.With("proxy_error_message_enabled", ProxyErrorMessageEnabled)
|
||||
.With("hid_display_split", HidDisplaySplit)
|
||||
);
|
||||
|
||||
public new void AssertIsValid()
|
||||
|
|
@ -88,6 +90,9 @@ public class SystemConfigPatch: PatchObject
|
|||
if (ProxyErrorMessageEnabled.IsPresent)
|
||||
o.Add("proxy_error_message_enabled", ProxyErrorMessageEnabled.Value);
|
||||
|
||||
if (HidDisplaySplit.IsPresent)
|
||||
o.Add("hid_display_split", HidDisplaySplit.Value);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
@ -119,6 +124,9 @@ public class SystemConfigPatch: PatchObject
|
|||
if (o.ContainsKey("proxy_error_message_enabled"))
|
||||
patch.ProxyErrorMessageEnabled = o.Value<bool>("proxy_error_message_enabled");
|
||||
|
||||
if (o.ContainsKey("hid_display_split"))
|
||||
patch.HidDisplaySplit = o.Value<bool>("hid_display_split");
|
||||
|
||||
return patch;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,8 +19,9 @@ public class SystemConfig
|
|||
|
||||
public DateTimeZone Zone => DateTimeZoneProviders.Tzdb.GetZoneOrNull(UiTz);
|
||||
|
||||
public bool CaseSensitiveProxyTags { get; set; }
|
||||
public bool CaseSensitiveProxyTags { get; }
|
||||
public bool ProxyErrorMessageEnabled { get; }
|
||||
public bool HidDisplaySplit { get; }
|
||||
}
|
||||
|
||||
public static class SystemConfigExt
|
||||
|
|
@ -39,6 +40,7 @@ public static class SystemConfigExt
|
|||
o.Add("group_limit", cfg.GroupLimitOverride ?? Limits.MaxGroupCount);
|
||||
o.Add("case_sensitive_proxy_tags", cfg.CaseSensitiveProxyTags);
|
||||
o.Add("proxy_error_message_enabled", cfg.ProxyErrorMessageEnabled);
|
||||
o.Add("hid_display_split", cfg.HidDisplaySplit);
|
||||
|
||||
o.Add("description_templates", JArray.FromObject(cfg.DescriptionTemplates));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue