Skip to content

Log ability grants from the recalc job #2132

Description

@cellio

If a moderator manually grants (or revokes) an ability, we add an entry to the admin audit log. For consistency, and to be able to help monitor the earning of abilities, let's also add an entry for automatic grants.

The log entry for manual grants is in UsersController.mod_privilege_action. That method calls CommunityUser.grant_privilege!. My first thought was to move the logging to grant_privilege!, but that might make mod_privilege_action harder to read (other things are logged there). It would also mean passing the performing user in; on the one hand that's starting to clutter the model with side effects, but on the other hand, we're already performing the notification there. Automatic grants call grant_privilege! from CommunityUser.recalc_privilege!, so maybe log there and leave the grant and its notification alone?

The entry in the audit log should be attributed to System.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions