mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 23:07:54 +00:00
Various additional tweaks/additions to groups
This commit is contained in:
parent
9e251352c7
commit
1bb5d203df
12 changed files with 109 additions and 25 deletions
|
|
@ -10,11 +10,13 @@ namespace PluralKit.Core
|
|||
public SystemId System { get; }
|
||||
|
||||
public string Name { get; } = null!;
|
||||
public string? DisplayName { get; }
|
||||
public string? Description { get; }
|
||||
public string? Icon { get; }
|
||||
|
||||
public PrivacyLevel DescriptionPrivacy { get; }
|
||||
public PrivacyLevel IconPrivacy { get; }
|
||||
public PrivacyLevel ListPrivacy { get; }
|
||||
public PrivacyLevel Visibility { get; }
|
||||
|
||||
public Instant Created { get; }
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ namespace PluralKit.Core {
|
|||
public PrivacyLevel MemberListPrivacy { get;}
|
||||
public PrivacyLevel FrontPrivacy { get; }
|
||||
public PrivacyLevel FrontHistoryPrivacy { get; }
|
||||
public PrivacyLevel GroupListPrivacy { get; }
|
||||
|
||||
[JsonIgnore] public DateTimeZone Zone => DateTimeZoneProviders.Tzdb.GetZoneOrNull(UiTz);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,23 @@ namespace PluralKit.Core
|
|||
public class GroupPatch: PatchObject
|
||||
{
|
||||
public Partial<string> Name { get; set; }
|
||||
public Partial<string?> DisplayName { get; set; }
|
||||
public Partial<string?> Description { get; set; }
|
||||
public Partial<string?> Icon { get; set; }
|
||||
|
||||
public Partial<PrivacyLevel> DescriptionPrivacy { get; set; }
|
||||
public Partial<PrivacyLevel> IconPrivacy { get; set; }
|
||||
public Partial<PrivacyLevel> ListPrivacy { get; set; }
|
||||
public Partial<PrivacyLevel> Visibility { get; set; }
|
||||
|
||||
public override UpdateQueryBuilder Apply(UpdateQueryBuilder b) => b
|
||||
.With("name", Name)
|
||||
.With("display_name", DisplayName)
|
||||
.With("description", Description)
|
||||
.With("icon", Icon)
|
||||
.With("description_privacy", DescriptionPrivacy)
|
||||
.With("icon_privacy", IconPrivacy)
|
||||
.With("list_privacy", ListPrivacy)
|
||||
.With("visibility", Visibility);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ namespace PluralKit.Core
|
|||
public Partial<string> UiTz { get; set; }
|
||||
public Partial<PrivacyLevel> DescriptionPrivacy { get; set; }
|
||||
public Partial<PrivacyLevel> MemberListPrivacy { get; set; }
|
||||
public Partial<PrivacyLevel> GroupListPrivacy { get; set; }
|
||||
public Partial<PrivacyLevel> FrontPrivacy { get; set; }
|
||||
public Partial<PrivacyLevel> FrontHistoryPrivacy { get; set; }
|
||||
public Partial<bool> PingsEnabled { get; set; }
|
||||
|
|
@ -24,6 +25,7 @@ namespace PluralKit.Core
|
|||
.With("ui_tz", UiTz)
|
||||
.With("description_privacy", DescriptionPrivacy)
|
||||
.With("member_list_privacy", MemberListPrivacy)
|
||||
.With("group_list_privacy", GroupListPrivacy)
|
||||
.With("front_privacy", FrontPrivacy)
|
||||
.With("front_history_privacy", FrontHistoryPrivacy)
|
||||
.With("pings_enabled", PingsEnabled);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace PluralKit.Core
|
|||
{
|
||||
Description,
|
||||
Icon,
|
||||
List,
|
||||
Visibility
|
||||
}
|
||||
|
||||
|
|
@ -18,6 +19,7 @@ namespace PluralKit.Core
|
|||
{
|
||||
GroupPrivacySubject.Description => group.DescriptionPrivacy = level,
|
||||
GroupPrivacySubject.Icon => group.IconPrivacy = level,
|
||||
GroupPrivacySubject.List => group.ListPrivacy = level,
|
||||
GroupPrivacySubject.Visibility => group.Visibility = level,
|
||||
_ => throw new ArgumentOutOfRangeException($"Unknown privacy subject {subject}")
|
||||
};
|
||||
|
|
@ -52,9 +54,13 @@ namespace PluralKit.Core
|
|||
case "hidden":
|
||||
case "shown":
|
||||
case "visible":
|
||||
case "list":
|
||||
subject = GroupPrivacySubject.Visibility;
|
||||
break;
|
||||
case "list":
|
||||
case "listing":
|
||||
case "members":
|
||||
subject = GroupPrivacySubject.List;
|
||||
break;
|
||||
default:
|
||||
subject = default;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ namespace PluralKit.Core
|
|||
public static string Explanation(this PrivacyLevel level) =>
|
||||
level switch
|
||||
{
|
||||
PrivacyLevel.Private => "**Private** (visible only when queried by you)",
|
||||
PrivacyLevel.Public => "**Public** (visible to everyone)",
|
||||
PrivacyLevel.Private => "Private *(visible only when queried by you)*",
|
||||
PrivacyLevel.Public => "Public *(visible to everyone)*",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(level), level, null)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace PluralKit.Core
|
|||
{
|
||||
Description,
|
||||
MemberList,
|
||||
GroupList,
|
||||
Front,
|
||||
FrontHistory
|
||||
}
|
||||
|
|
@ -21,6 +22,7 @@ namespace PluralKit.Core
|
|||
SystemPrivacySubject.Front => system.FrontPrivacy = level,
|
||||
SystemPrivacySubject.FrontHistory => system.FrontHistoryPrivacy = level,
|
||||
SystemPrivacySubject.MemberList => system.MemberListPrivacy = level,
|
||||
SystemPrivacySubject.GroupList => system.GroupListPrivacy = level,
|
||||
_ => throw new ArgumentOutOfRangeException($"Unknown privacy subject {subject}")
|
||||
};
|
||||
|
||||
|
|
@ -61,6 +63,10 @@ namespace PluralKit.Core
|
|||
case "fh":
|
||||
subject = SystemPrivacySubject.FrontHistory;
|
||||
break;
|
||||
case "groups":
|
||||
case "gs":
|
||||
subject = SystemPrivacySubject.GroupList;
|
||||
break;
|
||||
default:
|
||||
subject = default;
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue