chore: fix pre-existing dotnet-format whitespace drift
Purely mechanical (object-initializer line-splitting per the project's format rules) — no behavior change. This drift on develop was blocking the pre-commit hook's solution-wide 'dotnet format --verify-no-changes' check for unrelated commits. Verified: diff is cosmetic only (spot-checked), build + all 39 tests still pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -42,8 +42,15 @@ public class WidgetLayoutController : ApiControllerBase
|
|||||||
{
|
{
|
||||||
_db.WidgetLayouts.Add(new WidgetLayout
|
_db.WidgetLayouts.Add(new WidgetLayout
|
||||||
{
|
{
|
||||||
UserId = UserId, WidgetKey = dto.WidgetKey, X = dto.X, Y = dto.Y, W = dto.W, H = dto.H,
|
UserId = UserId,
|
||||||
Visible = dto.Visible, SortOrder = dto.SortOrder, SettingsJson = dto.SettingsJson
|
WidgetKey = dto.WidgetKey,
|
||||||
|
X = dto.X,
|
||||||
|
Y = dto.Y,
|
||||||
|
W = dto.W,
|
||||||
|
H = dto.H,
|
||||||
|
Visible = dto.Visible,
|
||||||
|
SortOrder = dto.SortOrder,
|
||||||
|
SettingsJson = dto.SettingsJson
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,13 +133,13 @@ public class AnalyticsService : IAnalyticsService
|
|||||||
var emails = _db.Emails.Where(e => e.UserId == userId);
|
var emails = _db.Emails.Where(e => e.UserId == userId);
|
||||||
|
|
||||||
var allMail = await emails.CountAsync(ct);
|
var allMail = await emails.CountAsync(ct);
|
||||||
var inbox = await emails.CountAsync(e => e.IsInInbox, ct);
|
var inbox = await emails.CountAsync(e => e.IsInInbox, ct);
|
||||||
var unread = await emails.CountAsync(e => e.IsUnread, ct);
|
var unread = await emails.CountAsync(e => e.IsUnread, ct);
|
||||||
var starred = await emails.CountAsync(e => e.IsStarred, ct);
|
var starred = await emails.CountAsync(e => e.IsStarred, ct);
|
||||||
var trash = await emails.CountAsync(e => e.IsTrashed, ct);
|
var trash = await emails.CountAsync(e => e.IsTrashed, ct);
|
||||||
var large = await emails.CountAsync(e => e.SizeEstimateBytes > 5_000_000, ct);
|
var large = await emails.CountAsync(e => e.SizeEstimateBytes > 5_000_000, ct);
|
||||||
var cutoff = DateTimeOffset.UtcNow.AddYears(-1);
|
var cutoff = DateTimeOffset.UtcNow.AddYears(-1);
|
||||||
var old = await emails.CountAsync(e => e.SentAtUtc < cutoff, ct);
|
var old = await emails.CountAsync(e => e.SentAtUtc < cutoff, ct);
|
||||||
|
|
||||||
// Label-backed counts (SENT / DRAFT / SPAM are system Gmail labels)
|
// Label-backed counts (SENT / DRAFT / SPAM are system Gmail labels)
|
||||||
async Task<int> LabelCount(string gmailId)
|
async Task<int> LabelCount(string gmailId)
|
||||||
@@ -153,9 +153,9 @@ public class AnalyticsService : IAnalyticsService
|
|||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sent = await LabelCount("SENT");
|
var sent = await LabelCount("SENT");
|
||||||
var drafts = await LabelCount("DRAFT");
|
var drafts = await LabelCount("DRAFT");
|
||||||
var spam = await LabelCount("SPAM");
|
var spam = await LabelCount("SPAM");
|
||||||
|
|
||||||
// Category → smart-folder slug mapping
|
// Category → smart-folder slug mapping
|
||||||
var catCounts = await emails
|
var catCounts = await emails
|
||||||
@@ -167,31 +167,31 @@ public class AnalyticsService : IAnalyticsService
|
|||||||
|
|
||||||
var smartFolders = new Dictionary<string, int>
|
var smartFolders = new Dictionary<string, int>
|
||||||
{
|
{
|
||||||
["automated"] = Cat(EmailCategory.Notification),
|
["automated"] = Cat(EmailCategory.Notification),
|
||||||
["finance"] = Cat(EmailCategory.Finance),
|
["finance"] = Cat(EmailCategory.Finance),
|
||||||
["social"] = Cat(EmailCategory.Social),
|
["social"] = Cat(EmailCategory.Social),
|
||||||
["shopping"] = Cat(EmailCategory.Shopping) + Cat(EmailCategory.Promotional),
|
["shopping"] = Cat(EmailCategory.Shopping) + Cat(EmailCategory.Promotional),
|
||||||
["noreply"] = Cat(EmailCategory.Notification),
|
["noreply"] = Cat(EmailCategory.Notification),
|
||||||
["gaming"] = Cat(EmailCategory.Gaming),
|
["gaming"] = Cat(EmailCategory.Gaming),
|
||||||
["sales"] = Cat(EmailCategory.SeasonalSales),
|
["sales"] = Cat(EmailCategory.SeasonalSales),
|
||||||
["ridesharing"] = Cat(EmailCategory.RideSharing),
|
["ridesharing"] = Cat(EmailCategory.RideSharing),
|
||||||
["food"] = Cat(EmailCategory.FoodDelivery),
|
["food"] = Cat(EmailCategory.FoodDelivery),
|
||||||
["wellness"] = Cat(EmailCategory.Wellness),
|
["wellness"] = Cat(EmailCategory.Wellness),
|
||||||
// New categories
|
// New categories
|
||||||
["travel"] = Cat(EmailCategory.Travel),
|
["travel"] = Cat(EmailCategory.Travel),
|
||||||
["subscriptions"] = Cat(EmailCategory.Subscriptions),
|
["subscriptions"] = Cat(EmailCategory.Subscriptions),
|
||||||
["parcels"] = Cat(EmailCategory.Parcels),
|
["parcels"] = Cat(EmailCategory.Parcels),
|
||||||
["recruitment"] = Cat(EmailCategory.Recruitment),
|
["recruitment"] = Cat(EmailCategory.Recruitment),
|
||||||
["events"] = Cat(EmailCategory.Events),
|
["events"] = Cat(EmailCategory.Events),
|
||||||
["security"] = Cat(EmailCategory.SecurityAlerts),
|
["security"] = Cat(EmailCategory.SecurityAlerts),
|
||||||
["healthcare"] = Cat(EmailCategory.Healthcare),
|
["healthcare"] = Cat(EmailCategory.Healthcare),
|
||||||
["education"] = Cat(EmailCategory.Education),
|
["education"] = Cat(EmailCategory.Education),
|
||||||
["news"] = Cat(EmailCategory.NewsMedia),
|
["news"] = Cat(EmailCategory.NewsMedia),
|
||||||
["property"] = Cat(EmailCategory.PropertyUtilities),
|
["property"] = Cat(EmailCategory.PropertyUtilities),
|
||||||
["charity"] = Cat(EmailCategory.Charity),
|
["charity"] = Cat(EmailCategory.Charity),
|
||||||
["government"] = Cat(EmailCategory.Government),
|
["government"] = Cat(EmailCategory.Government),
|
||||||
["crypto"] = Cat(EmailCategory.CryptoInvesting),
|
["crypto"] = Cat(EmailCategory.CryptoInvesting),
|
||||||
["family"] = Cat(EmailCategory.FamilySchool),
|
["family"] = Cat(EmailCategory.FamilySchool),
|
||||||
};
|
};
|
||||||
|
|
||||||
return new SidebarCountsDto(inbox, allMail, unread, starred, sent, drafts, trash, spam, large, old, smartFolders);
|
return new SidebarCountsDto(inbox, allMail, unread, starred, sent, drafts, trash, spam, large, old, smartFolders);
|
||||||
|
|||||||
@@ -79,7 +79,10 @@ public class SearchService : ISearchService
|
|||||||
|
|
||||||
return new PagedResult<EmailSummaryDto>
|
return new PagedResult<EmailSummaryDto>
|
||||||
{
|
{
|
||||||
Items = items, Page = r.Page, PageSize = r.PageSize, TotalCount = total
|
Items = items,
|
||||||
|
Page = r.Page,
|
||||||
|
PageSize = r.PageSize,
|
||||||
|
TotalCount = total
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ public static class HeuristicClassifier
|
|||||||
public static EmailCategory Classify(GmailMessageDetail d)
|
public static EmailCategory Classify(GmailMessageDetail d)
|
||||||
{
|
{
|
||||||
var subject = (d.Subject ?? string.Empty).ToLowerInvariant();
|
var subject = (d.Subject ?? string.Empty).ToLowerInvariant();
|
||||||
var from = d.FromAddress.ToLowerInvariant();
|
var from = d.FromAddress.ToLowerInvariant();
|
||||||
|
|
||||||
// 1. Security alerts — highest priority, overrides everything
|
// 1. Security alerts — highest priority, overrides everything
|
||||||
if (SecuritySubjectHints.Any(h => subject.Contains(h)))
|
if (SecuritySubjectHints.Any(h => subject.Contains(h)))
|
||||||
|
|||||||
@@ -268,8 +268,12 @@ public class SyncService : ISyncService
|
|||||||
{
|
{
|
||||||
_db.Attachments.Add(new Attachment
|
_db.Attachments.Add(new Attachment
|
||||||
{
|
{
|
||||||
UserId = userId, EmailId = email.Id, FileName = Trunc(fileName, 512) ?? string.Empty,
|
UserId = userId,
|
||||||
MimeType = Trunc(mime, 255), SizeBytes = size, GmailAttachmentId = attId
|
EmailId = email.Id,
|
||||||
|
FileName = Trunc(fileName, 512) ?? string.Empty,
|
||||||
|
MimeType = Trunc(mime, 255),
|
||||||
|
SizeBytes = size,
|
||||||
|
GmailAttachmentId = attId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,8 +342,11 @@ public class SyncService : ISyncService
|
|||||||
if (thread is not null) return thread;
|
if (thread is not null) return thread;
|
||||||
thread = new MailThread
|
thread = new MailThread
|
||||||
{
|
{
|
||||||
UserId = userId, GmailThreadId = gmailThreadId, Subject = Trunc(subject, 1024),
|
UserId = userId,
|
||||||
Snippet = Trunc(snippet, 2048), FirstMessageUtc = sentAt
|
GmailThreadId = gmailThreadId,
|
||||||
|
Subject = Trunc(subject, 1024),
|
||||||
|
Snippet = Trunc(snippet, 2048),
|
||||||
|
FirstMessageUtc = sentAt
|
||||||
};
|
};
|
||||||
_db.Threads.Add(thread);
|
_db.Threads.Add(thread);
|
||||||
return thread;
|
return thread;
|
||||||
|
|||||||
Reference in New Issue
Block a user