Move system updates to the same patch system as members
This commit is contained in:
@@ -116,16 +116,17 @@ namespace PluralKit.Core
|
||||
await _data.AddAccount(system, accountId);
|
||||
}
|
||||
|
||||
await using var conn = await _db.Obtain();
|
||||
|
||||
// Apply system info
|
||||
system.Name = data.Name;
|
||||
if (data.Description != null) system.Description = data.Description;
|
||||
if (data.Tag != null) system.Tag = data.Tag;
|
||||
if (data.AvatarUrl != null) system.AvatarUrl = data.AvatarUrl;
|
||||
if (data.TimeZone != null) system.UiTz = data.TimeZone ?? "UTC";
|
||||
await _data.SaveSystem(system);
|
||||
var patch = new SystemPatch {Name = data.Name};
|
||||
if (data.Description != null) patch.Description = data.Description;
|
||||
if (data.Tag != null) patch.Tag = data.Tag;
|
||||
if (data.AvatarUrl != null) patch.AvatarUrl = data.AvatarUrl;
|
||||
if (data.TimeZone != null) patch.UiTz = data.TimeZone ?? "UTC";
|
||||
await conn.UpdateSystem(system.Id, patch);
|
||||
|
||||
// -- Member/switch import --
|
||||
await using var conn = await _db.Obtain();
|
||||
await using (var imp = await BulkImporter.Begin(system, conn))
|
||||
{
|
||||
// Tally up the members that didn't exist before, and check member count on import
|
||||
|
@@ -102,20 +102,6 @@ namespace PluralKit.Core {
|
||||
/// </summary>
|
||||
/// <exception>Throws an exception (TODO: which?) if the given account is not linked to the given system.</exception>
|
||||
Task RemoveAccount(PKSystem system, ulong accountToRemove);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the information within the given <see cref="PKSystem"/> struct to the data store.
|
||||
/// </summary>
|
||||
Task SaveSystem(PKSystem system);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the given system from the database.
|
||||
/// </summary>
|
||||
/// <para>
|
||||
/// This will also delete all the system's members, all system switches, and every message that has been proxied
|
||||
/// by members in the system.
|
||||
/// </para>
|
||||
Task DeleteSystem(PKSystem system);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a member by its user-facing human ID.
|
||||
|
Reference in New Issue
Block a user