From 40686f97e009dfa0853bbf1f7a6efcf931cb4119 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Mon, 1 Dec 2025 20:16:50 +0100 Subject: [PATCH] Show last 30 days instead of 72h for deletion requests (#1420) --- .../Models/RecentUsageAccountDeletions.cs | 6 ++-- .../Main/Models/RecentUsageDeletionsByIp.cs | 6 ++-- .../Main/Models/RecentUsageStatistics.cs | 8 +++--- .../RecentUsageAccountDeletionsTable.razor | 10 +++---- .../RecentUsageDeletionsByIpTable.razor | 10 +++---- .../Pages/Dashboard/RecentUsageStats.razor | 4 +-- .../Services/StatisticsService.cs | 28 +++++++++---------- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/apps/server/AliasVault.Admin/Main/Models/RecentUsageAccountDeletions.cs b/apps/server/AliasVault.Admin/Main/Models/RecentUsageAccountDeletions.cs index 153027c57..df1e7d1a5 100644 --- a/apps/server/AliasVault.Admin/Main/Models/RecentUsageAccountDeletions.cs +++ b/apps/server/AliasVault.Admin/Main/Models/RecentUsageAccountDeletions.cs @@ -8,7 +8,7 @@ namespace AliasVault.Admin.Main.Models; /// -/// Model representing usernames with most account deletions in the last 72 hours. +/// Model representing usernames with most account deletions in the last 30 days. /// public class RecentUsageAccountDeletions { @@ -18,9 +18,9 @@ public class RecentUsageAccountDeletions public string Username { get; set; } = string.Empty; /// - /// Gets or sets the number of account deletions for this username in the last 72 hours. + /// Gets or sets the number of account deletions for this username in the last 30 days. /// - public int DeletionCount72h { get; set; } + public int DeletionCount30d { get; set; } /// /// Gets or sets the date when the most recent account with this username was registered. diff --git a/apps/server/AliasVault.Admin/Main/Models/RecentUsageDeletionsByIp.cs b/apps/server/AliasVault.Admin/Main/Models/RecentUsageDeletionsByIp.cs index 6202d706c..cc0958eb3 100644 --- a/apps/server/AliasVault.Admin/Main/Models/RecentUsageDeletionsByIp.cs +++ b/apps/server/AliasVault.Admin/Main/Models/RecentUsageDeletionsByIp.cs @@ -8,7 +8,7 @@ namespace AliasVault.Admin.Main.Models; /// -/// Model representing IP addresses with most account deletions in the last 72 hours. +/// Model representing IP addresses with most account deletions in the last 30 days. /// public class RecentUsageDeletionsByIp { @@ -23,7 +23,7 @@ public class RecentUsageDeletionsByIp public string IpAddress { get; set; } = string.Empty; /// - /// Gets or sets the number of account deletions from this IP in the last 72 hours. + /// Gets or sets the number of account deletions from this IP in the last 30 days. /// - public int DeletionCount72h { get; set; } + public int DeletionCount30d { get; set; } } diff --git a/apps/server/AliasVault.Admin/Main/Models/RecentUsageStatistics.cs b/apps/server/AliasVault.Admin/Main/Models/RecentUsageStatistics.cs index 32fb6687c..5d1fced69 100644 --- a/apps/server/AliasVault.Admin/Main/Models/RecentUsageStatistics.cs +++ b/apps/server/AliasVault.Admin/Main/Models/RecentUsageStatistics.cs @@ -33,12 +33,12 @@ public class RecentUsageStatistics public List TopIpsByMobileLogins72h { get; set; } = new(); /// - /// Gets or sets the list of IP addresses with most account deletions in the last 72 hours. + /// Gets or sets the list of IP addresses with most account deletions in the last 30 days. /// - public List TopIpsByDeletions72h { get; set; } = new(); + public List TopIpsByDeletions30d { get; set; } = new(); /// - /// Gets or sets the list of usernames with most account deletions in the last 72 hours. + /// Gets or sets the list of usernames with most account deletions in the last 30 days. /// - public List TopUsernamesByDeletions72h { get; set; } = new(); + public List TopUsernamesByDeletions30d { get; set; } = new(); } diff --git a/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageAccountDeletionsTable.razor b/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageAccountDeletionsTable.razor index 3ef5237ed..5df33220b 100644 --- a/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageAccountDeletionsTable.razor +++ b/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageAccountDeletionsTable.razor @@ -4,8 +4,8 @@
-

Top Usernames by Account Deletions (Last 72h)

-

Usernames with the most account deletion events in the last 72 hours

+

Top Usernames by Account Deletions (Last 30d)

+

Usernames with the most account deletion events in the last 30 days

@@ -24,7 +24,7 @@ @deletion.Username - @deletion.DeletionCount72h.ToString("N0") + @deletion.DeletionCount30d.ToString("N0") @if (deletion.LastDeletionDate.HasValue) { @@ -47,7 +47,7 @@

No Recent Account Deletions

-

No account deletions occurred in the last 72 hours.

+

No account deletions occurred in the last 30 days.

} else @@ -71,7 +71,7 @@ private readonly List _tableColumns = new() { new() { Title = "Username", PropertyName = "Username", Sortable = false }, - new() { Title = "Deletions (72h)", PropertyName = "DeletionCount72h", Sortable = false }, + new() { Title = "Deletions (30d)", PropertyName = "DeletionCount30d", Sortable = false }, new() { Title = "Last Deletion", PropertyName = "LastDeletionDate", Sortable = false } }; diff --git a/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageDeletionsByIpTable.razor b/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageDeletionsByIpTable.razor index 669e15c80..2c734be47 100644 --- a/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageDeletionsByIpTable.razor +++ b/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsage/Components/RecentUsageDeletionsByIpTable.razor @@ -4,8 +4,8 @@
-

Top IP Addresses by Account Deletions (Last 72h)

-

IP addresses with the most account deletions in the last 72 hours (last octet anonymized)

+

Top IP Addresses by Account Deletions (Last 30d)

+

IP addresses with the most account deletions in the last 30 days (last octet anonymized)

@@ -24,7 +24,7 @@ @ip.IpAddress - @ip.DeletionCount72h.ToString("N0") + @ip.DeletionCount30d.ToString("N0") } @@ -37,7 +37,7 @@

No Recent Account Deletions

-

No account deletions occurred in the last 72 hours.

+

No account deletions occurred in the last 30 days.

} else @@ -61,7 +61,7 @@ private readonly List _tableColumns = new() { new() { Title = "IP Range", PropertyName = "IpAddress", Sortable = false }, - new() { Title = "Deletions (72h)", PropertyName = "DeletionCount72h", Sortable = false } + new() { Title = "Deletions (30d)", PropertyName = "DeletionCount30d", Sortable = false } }; private void HandlePageChanged(int page) diff --git a/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsageStats.razor b/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsageStats.razor index dc2432817..4ca7b6d6b 100644 --- a/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsageStats.razor +++ b/apps/server/AliasVault.Admin/Main/Pages/Dashboard/RecentUsageStats.razor @@ -32,10 +32,10 @@ - + - + @if (_loadingError) diff --git a/apps/server/AliasVault.Admin/Services/StatisticsService.cs b/apps/server/AliasVault.Admin/Services/StatisticsService.cs index a9a73a9e5..08c1a7897 100644 --- a/apps/server/AliasVault.Admin/Services/StatisticsService.cs +++ b/apps/server/AliasVault.Admin/Services/StatisticsService.cs @@ -116,8 +116,8 @@ public class StatisticsService GetTopUsersByEmails72hAsync().ContinueWith(t => stats.TopUsersByEmails72h = t.Result), GetTopIpsByRegistrations72hAsync().ContinueWith(t => stats.TopIpsByRegistrations72h = t.Result), GetTopIpsByMobileLogins72hAsync().ContinueWith(t => stats.TopIpsByMobileLogins72h = t.Result), - GetTopIpsByDeletions72hAsync().ContinueWith(t => stats.TopIpsByDeletions72h = t.Result), - GetTopUsernamesByDeletions72hAsync().ContinueWith(t => stats.TopUsernamesByDeletions72h = t.Result), + GetTopIpsByDeletions30dAsync().ContinueWith(t => stats.TopIpsByDeletions30d = t.Result), + GetTopUsernamesByDeletions30dAsync().ContinueWith(t => stats.TopUsernamesByDeletions30d = t.Result), }; await Task.WhenAll(tasks); @@ -611,13 +611,13 @@ public class StatisticsService } /// - /// Gets the top 100 IP addresses by number of account deletions in the last 72 hours. + /// Gets the top 100 IP addresses by number of account deletions in the last 30 days. /// /// List of top IP addresses by recent account deletions. - private async Task> GetTopIpsByDeletions72hAsync() + private async Task> GetTopIpsByDeletions30dAsync() { await using var context = await _contextFactory.CreateDbContextAsync(); - var cutoffDate = DateTime.UtcNow.AddHours(-72); + var cutoffDate = DateTime.UtcNow.AddDays(-30); // Get account deletions by IP from auth logs (using AccountDeletion event type) var topIps = await context.AuthLogs @@ -629,9 +629,9 @@ public class StatisticsService .Select(g => new { IpAddress = g.Key, - DeletionCount72h = g.Count(), + DeletionCount30d = g.Count(), }) - .OrderByDescending(ip => ip.DeletionCount72h) + .OrderByDescending(ip => ip.DeletionCount30d) .Take(100) .ToListAsync(); @@ -639,18 +639,18 @@ public class StatisticsService { OriginalIpAddress = ip.IpAddress!, IpAddress = AnonymizeIpAddress(ip.IpAddress!), - DeletionCount72h = ip.DeletionCount72h, + DeletionCount30d = ip.DeletionCount30d, }).ToList(); } /// - /// Gets the top 100 usernames by number of account deletions in the last 72 hours. + /// Gets the top 100 usernames by number of account deletions in the last 30 days. /// /// List of top usernames by recent account deletions. - private async Task> GetTopUsernamesByDeletions72hAsync() + private async Task> GetTopUsernamesByDeletions30dAsync() { await using var context = await _contextFactory.CreateDbContextAsync(); - var cutoffDate = DateTime.UtcNow.AddHours(-72); + var cutoffDate = DateTime.UtcNow.AddDays(-30); // Get account deletions by username from auth logs (using AccountDeletion event type) var topUsernames = await context.AuthLogs @@ -661,17 +661,17 @@ public class StatisticsService .Select(g => new { Username = g.Key, - DeletionCount72h = g.Count(), + DeletionCount30d = g.Count(), LastDeletionDate = g.Max(al => al.Timestamp), }) - .OrderByDescending(u => u.DeletionCount72h) + .OrderByDescending(u => u.DeletionCount30d) .Take(100) .ToListAsync(); return topUsernames.Select(u => new RecentUsageAccountDeletions { Username = u.Username!, - DeletionCount72h = u.DeletionCount72h, + DeletionCount30d = u.DeletionCount30d, LastDeletionDate = u.LastDeletionDate, }).ToList(); }