feat: add a wait before a notice can be accepted
This commit is contained in:
@@ -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.";
|
||||
|
||||
Reference in New Issue
Block a user