mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 07:47:53 +00:00
feat: config setting to automatically set members/groups to private when creating
This commit is contained in:
parent
7c37726afb
commit
1ff6bb76cd
10 changed files with 140 additions and 24 deletions
|
|
@ -64,14 +64,24 @@ public class Groups
|
|||
throw new PKError("Group creation cancelled.");
|
||||
}
|
||||
|
||||
using var conn = await _db.Obtain();
|
||||
var newGroup = await _repo.CreateGroup(ctx.System.Id, groupName);
|
||||
|
||||
_ = _dispatch.Dispatch(newGroup.Id,
|
||||
new UpdateDispatchData
|
||||
{
|
||||
Event = DispatchEvent.CREATE_GROUP,
|
||||
EventData = JObject.FromObject(new { name = groupName })
|
||||
});
|
||||
var dispatchData = new JObject();
|
||||
dispatchData.Add("name", groupName);
|
||||
|
||||
if (ctx.Config.GroupDefaultPrivate)
|
||||
{
|
||||
var patch = new GroupPatch().WithAllPrivacy(PrivacyLevel.Private);
|
||||
await _repo.UpdateGroup(newGroup.Id, patch, conn);
|
||||
dispatchData.Merge(patch.ToJson());
|
||||
}
|
||||
|
||||
_ = _dispatch.Dispatch(newGroup.Id, new UpdateDispatchData
|
||||
{
|
||||
Event = DispatchEvent.CREATE_GROUP,
|
||||
EventData = dispatchData
|
||||
});
|
||||
|
||||
var eb = new EmbedBuilder()
|
||||
.Description(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue