diff --git a/pkg/controller/account/deactivate.go b/pkg/controller/account/deactivate.go index e9327cf..eaccbc1 100644 --- a/pkg/controller/account/deactivate.go +++ b/pkg/controller/account/deactivate.go @@ -43,7 +43,7 @@ func Deactivate() http.HandlerFunc { templates.Redirect(w, "/") // Log the change. - models.LogUpdated(currentUser, nil, "users", currentUser.ID, "Deactivated their account.", nil) + models.LogEvent(currentUser, nil, models.ChangeLogLifecycle, "users", currentUser.ID, "Deactivated their account.") return } @@ -83,6 +83,6 @@ func Reactivate() http.HandlerFunc { templates.Redirect(w, "/") // Log the change. - models.LogUpdated(currentUser, nil, "users", currentUser.ID, "Reactivated their account.", nil) + models.LogEvent(currentUser, nil, models.ChangeLogLifecycle, "users", currentUser.ID, "Reactivated their account.") }) } diff --git a/pkg/controller/admin/user_actions.go b/pkg/controller/admin/user_actions.go index 9baf7f3..5198a42 100644 --- a/pkg/controller/admin/user_actions.go +++ b/pkg/controller/admin/user_actions.go @@ -158,7 +158,7 @@ func UserActions() http.HandlerFunc { templates.Redirect(w, "/u/"+user.Username) // Log the change. - models.LogUpdated(user, currentUser, "users", currentUser.ID, fmt.Sprintf("User ban status updated to: %s", status), nil) + models.LogEvent(user, currentUser, models.ChangeLogBanned, "users", currentUser.ID, fmt.Sprintf("User ban status updated to: %s", status)) return } case "promote": @@ -177,7 +177,7 @@ func UserActions() http.HandlerFunc { templates.Redirect(w, "/u/"+user.Username) // Log the change. - models.LogUpdated(user, currentUser, "users", currentUser.ID, fmt.Sprintf("User admin status updated to: %s", action), nil) + models.LogEvent(user, currentUser, models.ChangeLogAdmin, "users", currentUser.ID, fmt.Sprintf("User admin status updated to: %s", action)) return } case "delete": diff --git a/pkg/models/change_log.go b/pkg/models/change_log.go index b7202d8..d766353 100644 --- a/pkg/models/change_log.go +++ b/pkg/models/change_log.go @@ -33,6 +33,11 @@ const ( // Certification photos. ChangeLogApproved = "approved" ChangeLogRejected = "rejected" + + // Account status updates for easier filtering. + ChangeLogBanned = "banned" + ChangeLogAdmin = "admin" // admin status toggle + ChangeLogLifecycle = "lifecycle" // de/reactivated accounts ) var ChangeLogEventTypes = []string{ @@ -41,6 +46,9 @@ var ChangeLogEventTypes = []string{ ChangeLogDeleted, ChangeLogApproved, ChangeLogRejected, + ChangeLogBanned, + ChangeLogAdmin, + ChangeLogLifecycle, } // PaginateChangeLog lists the change logs.