Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn decay #479

Merged
merged 4 commits into from
Aug 20, 2024
Merged

warn decay #479

merged 4 commits into from
Aug 20, 2024

Conversation

danthe1st
Copy link
Member

@danthe1st danthe1st commented Feb 12, 2024

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 last maxWarnValidityDays days).

grafik

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.

@danthe1st danthe1st added enhancement Improvement of an already existing feature open conversation Further information is requested labels Feb 12, 2024
@danthe1st danthe1st marked this pull request as ready for review February 12, 2024 18:32
@danthe1st danthe1st requested a review from a team as a code owner February 12, 2024 18:32
@jasonlessenich
Copy link
Member

bump

Copy link
Member

@liquiddevelopmentnet liquiddevelopmentnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@MoonTM-GIT MoonTM-GIT merged commit 2928ebc into Java-Discord:main Aug 20, 2024
1 check passed
@danthe1st danthe1st deleted the warn-decay branch August 21, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of an already existing feature open conversation Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants