Repository navigation
Add moderation actions table - #298
Merged
Merged
Conversation
Zabuzard
requested review from
RealYusufIsmail,
Tais993,
illuminator3,
java-coding-prodigy and
marko-radosavljevic
December 3, 2021 10:59
Zabuzard
commented
Dec 3, 2021
Closed
* ban * unban * kick
Zabuzard
force-pushed
the
feature/mod_actions_table
branch
from
December 7, 2021 17:22
c793b88 to
5d214eb
Compare
Zabuzard
enabled auto-merge (rebase)
December 7, 2021 18:13
RealYusufIsmail
previously approved these changes
Dec 7, 2021
RealYusufIsmail
left a comment
Contributor
There was a problem hiding this comment.
I have looked thorough it and all looks good.
Tais993
previously requested changes
Dec 8, 2021
|
Kudos, SonarCloud Quality Gate passed! |
Tais993
approved these changes
Dec 9, 2021
RealYusufIsmail
approved these changes
Dec 10, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.








Overview
Implements and closes #297. This is a crucial pre-requisite that blocks a whole list of features that are currently either being developed or in planning:
This feature basically logs each moderation action (ban, kick, mute, ...) in a database table, with all necessary information such as target, author, timestamp, reason and more. This can then be used by other classes later to retrieve information (see list of blocked features).
Details
The implementation adds a new database table
moderation_actions:which is hidden behind a helper class
ModerationActionsStorewith retrieval methods such as:getActionsByTypeAscendinggetActionsByTargetAscendinggetActionsByAuthorAscendingfindActionByCaseId(while those methods are not used right now, they will be used very soon by the mentioned features)
to add a new entry, one calls
addActionAdditionally, the store has been integrated into all currently existing commands:
BanCommandUnbanCommandKickCommandso those commands will now also correctly add the entry to the database, when executed.
Notes
The point in time commands call the
addActionmethod as of now is slightly off the actual point in time the action is executed.Simplified speaking, we have
while the
bancommand is obviously a rest action that might be executed slightly deferred. That said, we could potentially usein most cases instead (but maybe not all). However, the time will then still be slightly offset (even if its just some milliseconds).
(I wrote it like that to stay consistent with the point in time we have our actual log message being written. So if we should change this, the log also has to go into the
mapcall)tl;dr: It is not really possible to get the exact timestamp that the action is executed at. Hence, future methods that are added to
ModerationActionsStore, such as timestamp-based retrieval (thinking about #280), must be implemented with a time variance in mind (action closest to timestamp ...).Checklist