public class DefaultCommentsPerIssueLimitValidator extends Object implements CommentsPerIssueLimitValidator
Checks that the target issue contains less comments than configured limit.
Enabled/Disabled by using the feature flag 'com.atlassian.jira.safeguards'
The limit on allowed comments per issue is configured by the Application Property 'jira.safeguards.issue.comments'
Constructor and Description |
---|
DefaultCommentsPerIssueLimitValidator(CommentSearchManager commentSearchManager,
FeatureManager featureManager,
JiraAuthenticationContext jiraAuthenticationContext,
RestrictedUsersComponent restrictedUsersComponent,
SafeguardsManager safeguardsManager,
CommentsPerIssueLimitNotifier notifier,
ClusterManager clusterManager,
com.atlassian.audit.core.spi.service.IpAddressProvider ipAddressProvider) |
Modifier and Type | Method and Description |
---|---|
List<Issue> |
getInvalidIssues(List<Issue> issues)
Validates comment limits for all provided issues and returns issues that failed.
|
long |
getLimit()
Returns the value of the limit as configured at the time of calling,
|
boolean |
isValid(Issue issue,
ApplicationUser author,
String commentBody,
ErrorCollection errorCollection)
Checks if limit is not reached yet
(eg.
|
void |
validate(Issue issue,
ApplicationUser author,
String commentBody)
Checks if limit is not reached yet
(eg.
|
public DefaultCommentsPerIssueLimitValidator(CommentSearchManager commentSearchManager, FeatureManager featureManager, JiraAuthenticationContext jiraAuthenticationContext, RestrictedUsersComponent restrictedUsersComponent, SafeguardsManager safeguardsManager, CommentsPerIssueLimitNotifier notifier, ClusterManager clusterManager, com.atlassian.audit.core.spi.service.IpAddressProvider ipAddressProvider)
public boolean isValid(@Nonnull Issue issue, @Nullable ApplicationUser author, @Nonnull String commentBody, @Nonnull ErrorCollection errorCollection)
CommentsPerIssueLimitValidator
isValid
in interface CommentsPerIssueLimitValidator
issue
- entity analysed for comment numberauthor
- comment creatorcommentBody
- comment body@Nonnull public List<Issue> getInvalidIssues(@Nonnull List<Issue> issues)
CommentsPerIssueLimitValidator
getInvalidIssues
in interface CommentsPerIssueLimitValidator
issues
- list of issuespublic void validate(@Nonnull Issue issue, @Nullable ApplicationUser author, @Nonnull String commentBody) throws CommentsPerIssueLimitExceededException
CommentsPerIssueLimitValidator
validate
in interface CommentsPerIssueLimitValidator
issue
- entity analysed for comment numberauthor
- comment creatorcommentBody
- comment bodyCommentsPerIssueLimitExceededException
- if validation failspublic long getLimit()
CommentsPerIssueLimitValidator
getLimit
in interface CommentsPerIssueLimitValidator
Copyright © 2002-2024 Atlassian. All Rights Reserved.