Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds functionality to slowly decrease the severtiy of warns over time.
The severity weight subtraction removed does not scale with the severity of the warns.
Having more/higher-severity warns does not mean that the severity is reduced more.
It also includes a refactoring of
ModerationService
to be a Spring-managed bean/service class.Furthermore, it changes
/warn discard-all
to only discard potentially active warns (i.e. warns issues within the lastmaxWarnValidityDays
days).logical view
Only warns from the last
maxWarnValidityDays
days are checked.Every
warnDecayDays
days,warnDecayAmount
of severity are subtracted from the total severity of the user.This method does not allow negative severities at any point in time.
The oldest considered warn decides on the amount of severity to subtract.
Hence, all warns that would (together) not increase the severity due to being too old are ignored.
implementation
The total severity is calculated per warn by considering the severity of all warns after the given warn and subtracting the discount subtrahend corresponding to the given (oldest) warn from the severity.
Then, the maximum discounted severity over all warns is chosen.
See
ModerationService#getTotalSeverityWeight
Deploy notes
The config needs to be adapted. Merging this PR alone without any config changes shouldn't change anything about the warn system.
As this is a significant change, it should be communicated properly.