Fix hidden add/remove template buttons, add per-template login filter
The add/remove template buttons sat directly below the fixed-height list with only 6px of margin to the tab's bottom edge - enough on this dev machine but not on the operator's real one (different DPI/font scale), so the buttons rendered off the visible area. Moved them above the list instead (visibility no longer depends on how much space is left at the bottom) and gave the whole "Шаблоны" tab substantially more vertical room throughout. Also added an optional per-template login regex filter (MailTemplateDefinition.LoginPattern): once a file's suffix matches a template, its login must also match that template's pattern (if any) or the row surfaces as a clear Error in the preview instead of silently going through - addresses "непонятно что будет работать". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
804b9610ca
commit
6e823954a3
8 files changed
+385
-50
No files matched your search
@@ -24,6 +24,10 @@ namespace BulkArchiveMailer.Core
|
||||
|
||||
[DataMember(Name = "bodyHtml")]
|
||||
public string BodyHtml { get; set; } = "";
|
||||
|
||||
/// <summary>See MailTemplateDefinition.LoginPattern. Absent from any config.json written before v1.2.0 - DataContractJsonSerializer leaves this null (not "") for those, same caveat as every other string member here; ToTemplateList/SetTemplates and every call site normalize via `?? ""`.</summary>
|
||||
[DataMember(Name = "loginPattern")]
|
||||
public string LoginPattern { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>Shape of %APPDATA%\BulkArchiveMailer\config.json (and of the embedded config.default.json that seeds it).</summary>
|
||||
@@ -95,6 +99,7 @@ namespace BulkArchiveMailer.Core
|
||||
FileSuffix = t?.FileSuffix ?? "",
|
||||
Subject = t?.Subject ?? "",
|
||||
BodyHtml = t?.BodyHtml ?? "",
|
||||
LoginPattern = t?.LoginPattern ?? "",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,6 +120,7 @@ namespace BulkArchiveMailer.Core
|
||||
FileSuffix = t?.FileSuffix ?? "",
|
||||
Subject = t?.Subject ?? "",
|
||||
BodyHtml = t?.BodyHtml ?? "",
|
||||
LoginPattern = t?.LoginPattern ?? "",
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -380,6 +386,11 @@ namespace BulkArchiveMailer.Core
|
||||
FileSuffix = "ssh_access",
|
||||
Subject = legacy?.Templates?.SshAccess?.Subject ?? "",
|
||||
BodyHtml = legacy?.Templates?.SshAccess?.BodyHtml ?? "",
|
||||
// The legacy shape never had a per-template login
|
||||
// filter - migrated entries keep the old
|
||||
// unrestricted "suffix alone decides the match"
|
||||
// behavior.
|
||||
LoginPattern = "",
|
||||
},
|
||||
new MailTemplateData
|
||||
{
|
||||
@@ -387,6 +398,7 @@ namespace BulkArchiveMailer.Core
|
||||
FileSuffix = "config_update",
|
||||
Subject = legacy?.Templates?.ConfigUpdate?.Subject ?? "",
|
||||
BodyHtml = legacy?.Templates?.ConfigUpdate?.BodyHtml ?? "",
|
||||
LoginPattern = "",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user