Skip to content

Commit d18d3ec

Browse files
Fix Directory.Build.props, move requirement for higher rank when moderating to only ban/mutes, change updated to created date on tags since we do not track edit datetimes
1 parent e1a5b1f commit d18d3ec

File tree

11 files changed

+88
-101
lines changed

11 files changed

+88
-101
lines changed

Directory.Build.props

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<LangVersion>preview</LangVersion>
55
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
66
<UserSecretsId>5B9ECED8-0E0C-443E-98B1-F1E508AB292B</UserSecretsId>
7-
<RestoreSources>
8-
https://api.nuget.org/v3/index.json;
9-
https://www.myget.org/F/discord-net/api/v3/index.json;
10-
</RestoreSources>
117
</PropertyGroup>
128
</Project>

Directory.Build.targets

Lines changed: 0 additions & 77 deletions
This file was deleted.

Directory.Packages.props

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
6+
<ItemGroup>
7+
<PackageVersion Include="Discord.Net" Version="3.17.4" />
8+
9+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
10+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.5"/>
11+
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.5" />
12+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
13+
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
14+
15+
<PackageVersion Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
16+
17+
<PackageVersion Include="AspNet.Security.OAuth.Discord" Version="9.0.0" />
18+
19+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.5" />
20+
<PackageVersion Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="9.0.5" />
21+
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.5" />
22+
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.5" />
23+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.5" />
24+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
25+
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.5" />
26+
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.5" />
27+
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="9.0.5" />
28+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
29+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.5" />
30+
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.5" />
31+
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.5" />
32+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
33+
34+
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
35+
36+
<PackageVersion Include="LZStringCSharp" Version="1.4.0" />
37+
38+
<PackageVersion Include="LinqKit.Microsoft.EntityFrameworkCore" Version="9.0.8" />
39+
40+
<PackageVersion Include="Serilog" Version="4.3.0" />
41+
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
42+
<PackageVersion Include="Serilog.Expressions" Version="5.0.0" />
43+
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
44+
<PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
45+
46+
<PackageVersion Include="Humanizer.Core" Version="2.14.1" />
47+
48+
<PackageVersion Include="Moq" Version="4.18.4" />
49+
<PackageVersion Include="Moq.AutoMock" Version="3.5.0" />
50+
51+
<PackageVersion Include="NSubstitute" Version="3.0" />
52+
<PackageVersion Include="NUnit" Version="4.3.2" />
53+
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
54+
<PackageVersion Include="Shouldly" Version="4.3.0" />
55+
56+
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.8" />
57+
58+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
59+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.NUnit" Version="1.1.2" />
60+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.NUnit" Version="1.1.2" />
61+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
62+
63+
<PackageVersion Include="protobuf-net" Version="3.2.52" />
64+
65+
<PackageVersion Include="MudBlazor" Version="6.19.1" />
66+
<PackageVersion Include="MudBlazor.Markdown" Version="0.1.3" />
67+
<PackageVersion Include="MediatR" Version="12.4.1" />
68+
</ItemGroup>
69+
</Project>

src/Modix.Analyzers/AddDoNotDefer/AddDoNotDeferAnalyzer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace Modix.Analyzers.AddDoNotDefer
1010
{
11-
[DiagnosticAnalyzer(LanguageNames.CSharp)]
1211
public class AddDoNotDeferAnalyzer : DiagnosticAnalyzer
1312
{
1413
public const string DiagnosticId = "MDX002";

src/Modix.Bot/Modix.Bot.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageReference Include="Humanizer.Core" />
7-
<PackageReference Include="MediatR" Version="12.4.1" />
7+
<PackageReference Include="MediatR" />
88
<PackageReference Include="Microsoft.Extensions.Hosting" />
99
<PackageReference Include="Microsoft.Extensions.Http" />
1010
<PackageReference Include="Newtonsoft.Json" />
1111
<PackageReference Include="LZStringCSharp" />
1212
<PackageReference Include="protobuf-net" />
13-
<!-- unneeded, after an upgrade to net9.0 or higher -->
14-
<PackageReference Include="Microsoft.Bcl.Memory" />
1513
</ItemGroup>
1614
<ItemGroup>
1715
<ProjectReference Include="..\Modix.Analyzers\Modix.Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all" SetTargetFramework="TargetFramework=netstandard2.0" />

src/Modix.Data/Models/Core/EphemeralUser.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public class EphemeralUser : IGuildUser
1313

1414
public string? Nickname { get; private set; }
1515

16+
public string? GuildBannerHash { get; private set; }
17+
1618
public GuildPermissions GuildPermissions { get; private set; } = new GuildPermissions();
1719

1820
public IGuild? Guild { get; private set; }
@@ -131,6 +133,8 @@ public ChannelPermissions GetPermissions(IGuildChannel channel)
131133
return OnGuildUserOrThrow(user => user.GetPermissions(channel));
132134
}
133135

136+
public string GetGuildBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) => throw new NotImplementedException();
137+
134138
public async Task KickAsync(string? reason = null, RequestOptions? options = null)
135139
{
136140
await OnGuildUserOrThrowAsync(u => u.KickAsync(reason, options));

src/Modix.Services/Moderation/ModerationService.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,22 @@ public async Task CreateInfractionAsync(ulong guildId, ulong moderatorId, Infrac
6767
throw new ArgumentException($"Reason must be less than {MaxReasonLength} characters in length",
6868
nameof(reason));
6969

70-
if (((type == InfractionType.Notice) || (type == InfractionType.Warning))
71-
&& string.IsNullOrWhiteSpace(reason))
70+
if (type is InfractionType.Notice or InfractionType.Warning && string.IsNullOrWhiteSpace(reason))
7271
throw new InvalidOperationException($"{type.ToString()} infractions require a reason to be given");
7372

7473
var guild = await discordClient.GetGuildAsync(guildId);
75-
var subject = await userService.TryGetGuildUserAsync(guild, subjectId, default);
76-
77-
await RequireSubjectRankLowerThanModeratorRankAsync(guild, moderatorId, subject);
74+
var subject = await userService.TryGetGuildUserAsync(guild, subjectId, CancellationToken.None);
7875

7976
using (var transaction = await infractionRepository.BeginCreateTransactionAsync())
8077
{
81-
if ((type == InfractionType.Mute) || (type == InfractionType.Ban))
78+
if (type is InfractionType.Ban or InfractionType.Mute)
8279
{
80+
await RequireSubjectRankLowerThanModeratorRankAsync(guild, moderatorId, subject);
81+
8382
if (await infractionRepository.AnyAsync(new InfractionSearchCriteria()
8483
{
8584
GuildId = guildId,
86-
Types = new[] {type},
85+
Types = [type],
8786
SubjectId = subjectId,
8887
IsRescinded = false,
8988
IsDeleted = false
@@ -135,7 +134,6 @@ await DoRescindInfractionAsync(infraction!.Type, infraction.GuildId, infraction.
135134
reason);
136135
}
137136

138-
/// <inheritdoc />
139137
public async Task RescindInfractionAsync(InfractionType type, ulong guildId, ulong subjectId,
140138
string? reason = null)
141139
{

src/Modix.Services/Modix.Services.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ItemGroup>
33
<PackageReference Include="Discord.Net" />
44
<PackageReference Include="Humanizer.Core" />
5-
<PackageReference Include="MediatR" Version="12.4.1" />
5+
<PackageReference Include="MediatR" />
66
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
77
<PackageReference Include="Microsoft.Extensions.Http" />
88
<PackageReference Include="Newtonsoft.Json" />

src/Modix.Web/Modix.Web.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<ItemGroup>
1111
<PackageReference Include="AspNet.Security.OAuth.Discord" />
1212
<PackageReference Include="Discord.Net" />
13-
<PackageReference Include="MudBlazor" Version="6.19.1" />
14-
<PackageReference Include="MudBlazor.Markdown" Version="0.1.3" />
13+
<PackageReference Include="MudBlazor" />
14+
<PackageReference Include="MudBlazor.Markdown" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/Modix.Web/Pages/Tags.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<MudTable Items="Data" SortLabel="Sort By" Bordered="true" Filter="FilterFunction">
5555
<HeaderContent>
5656
<MudTh Class="center-text"><MudTableSortLabel T="TagData" SortBy="x => x.Name">Name</MudTableSortLabel></MudTh>
57-
<MudTh Class="center-text"><MudTableSortLabel T="TagData" SortBy="x => x.Created">Last Modified</MudTableSortLabel></MudTh>
57+
<MudTh Class="center-text"><MudTableSortLabel T="TagData" SortBy="x => x.Created">Created</MudTableSortLabel></MudTh>
5858
<MudTh Class="center-text"><MudTableSortLabel T="TagData" SortBy="x => x.OwnerName">Owner</MudTableSortLabel></MudTh>
5959
<MudTh Class="center-text"><MudTableSortLabel T="TagData" SortBy="x => x.Content">Content</MudTableSortLabel></MudTh>
6060
<MudTh Class="center-text"><MudTableSortLabel T="TagData" SortBy="x => x.Uses">Uses</MudTableSortLabel></MudTh>

0 commit comments

Comments
 (0)