Fixed many issues with 5.2.0

This commit is contained in:
Toastie 2024-11-29 18:12:21 +13:00
parent 861b1251a5
commit 786646218c
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
5 changed files with 22 additions and 16 deletions

View file

@ -19,7 +19,7 @@ Mostly based on [keepachangelog](https://keepachangelog.com/en/1.1.0/) except da
### Fixed ### Fixed
- Fixed old .sar missing - Fixed old self assigned missing
## [5.2.0] - 28.11.2024 ## [5.2.0] - 28.11.2024

View file

@ -21,17 +21,14 @@ public static class MigrationQueries
INNER JOIN GuildConfigs as GC ON GN.GuildConfigId = GC.Id; INNER JOIN GuildConfigs as GC ON GN.GuildConfigId = GC.Id;
INSERT INTO Sar (GuildId, RoleId, SarGroupId, LevelReq) INSERT INTO Sar (GuildId, RoleId, SarGroupId, LevelReq)
SELECT SAR.GuildId, SAR.RoleId, SG2.Id, MIN(SAR.LevelRequirement) SELECT SAR.GuildId, SAR.RoleId, (SELECT Id FROM SarGroup WHERE SG.Number = SarGroup.GroupNumber AND SG.GuildId = SarGroup.GuildId), MIN(SAR.LevelRequirement)
FROM SelfAssignableRoles as SAR FROM SelfAssignableRoles as SAR
INNER JOIN (SELECT GuildId FROM GroupName as gn INNER JOIN (SELECT GuildId, gn.Number FROM GroupName as gn
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id
) as SG ) as SG
ON SG.GuildId = SAR.GuildId ON SG.GuildId = SAR.GuildId
INNER JOIN (SELECT gn.Id, Number FROM GroupName as gn WHERE SG.Number IN (SELECT GroupNumber FROM SarGroup WHERE Sar.GuildId = SarGroup.GuildId)
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id GROUP BY SAR.GuildId, SAR.RoleId;
) as SG2
ON SG2.Number = SAR."Group"
GROUP BY SAR.GuildId, SAR.RoleId;
INSERT INTO SarAutoDelete (GuildId, IsEnabled) INSERT INTO SarAutoDelete (GuildId, IsEnabled)
SELECT GuildId, AutoDeleteSelfAssignedRoleMessages FROM GuildConfigs WHERE AutoDeleteSelfAssignedRoleMessages = TRUE; SELECT GuildId, AutoDeleteSelfAssignedRoleMessages FROM GuildConfigs WHERE AutoDeleteSelfAssignedRoleMessages = TRUE;

View file

@ -283,7 +283,13 @@ public partial class Administration
{ {
var res = await _service.SetExclusiveButtonRoles(ctx.Guild.Id, messageId, exclusive.Value); var res = await _service.SetExclusiveButtonRoles(ctx.Guild.Id, messageId, exclusive.Value);
if (res) if (!res)
{
await Response().Error(strs.btnrole_not_found).SendAsync();
return;
}
if (exclusive.Value)
{ {
await Response().Confirm(strs.btnrole_exclusive).SendAsync(); await Response().Confirm(strs.btnrole_exclusive).SendAsync();
} }

View file

@ -126,7 +126,11 @@ public sealed class ButtonRolesService : IEService, IReadyExecutor
Emote = emoteStr, Emote = emoteStr,
Label = string.Empty, Label = string.Empty,
ButtonId = $"{BTN_PREFIX}:{guildId}:{guid}", ButtonId = $"{BTN_PREFIX}:{guildId}:{guid}",
Exclusive = (uow.GetTable<ButtonRole>().Where(x => x.GuildId == guildId && x.MessageId == messageId).All(x => x.Exclusive)) Exclusive = uow.GetTable<ButtonRole>()
.Any(x => x.GuildId == guildId && x.MessageId == messageId)
&& uow.GetTable<ButtonRole>()
.Where(x => x.GuildId == guildId && x.MessageId == messageId)
.All(x => x.Exclusive)
}, },
_ => new() _ => new()
{ {
@ -178,7 +182,6 @@ public sealed class ButtonRolesService : IEService, IReadyExecutor
.UpdateAsync((_) => new() .UpdateAsync((_) => new()
{ {
Exclusive = exclusive Exclusive = exclusive
}) }) > 0;
> 0;
} }
} }

View file

@ -80,7 +80,7 @@ public sealed class GuildColorsService : IReadyExecutor, IGuildColorsService, IE
{ {
_colors[guildId] = _colors[guildId] with _colors[guildId] = _colors[guildId] with
{ {
Error = color?.ToDiscordColor() Ok = color?.ToDiscordColor()
}; };
} }
} }
@ -108,7 +108,7 @@ public sealed class GuildColorsService : IReadyExecutor, IGuildColorsService, IE
{ {
_colors[guildId] = _colors[guildId] with _colors[guildId] = _colors[guildId] with
{ {
Pending = color?.ToDiscordColor() Ok = color?.ToDiscordColor()
}; };
} }
} }