feat: add a wait before a notice can be accepted

This commit is contained in:
2026-11-13 22:46:07 +01:00
parent 28b6244a17
commit 93036bae89
12 changed files with 131 additions and 7 deletions
@@ -19,6 +19,11 @@ public static class NoticeRules
/// </summary>
public const int MaxBodyLength = 20000;
/// <summary>
/// Longest wait before a notice can be accepted, in seconds.
/// </summary>
public const int MaxAcceptDelaySeconds = 600;
/// <summary>
/// Checks whether a notice is addressed to a user.
/// </summary>
@@ -124,6 +129,11 @@ public static class NoticeRules
return "Body is too long.";
}
if (draft.AcceptDelaySeconds < 0 || draft.AcceptDelaySeconds > MaxAcceptDelaySeconds)
{
return "The wait before accepting has to be between 0 and 600 seconds.";
}
if (draft.Target is { AllUsers: false } target && (target.UserIds is null || target.UserIds.Count == 0))
{
return "Select at least one user or address all users.";