Dedicated ChangeLog events for ban/lifecycle/admin changes
This commit is contained in:
parent
3142e0ce84
commit
2820cf581e
|
@ -43,7 +43,7 @@ func Deactivate() http.HandlerFunc {
|
||||||
templates.Redirect(w, "/")
|
templates.Redirect(w, "/")
|
||||||
|
|
||||||
// Log the change.
|
// 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,6 @@ func Reactivate() http.HandlerFunc {
|
||||||
templates.Redirect(w, "/")
|
templates.Redirect(w, "/")
|
||||||
|
|
||||||
// Log the change.
|
// 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.")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ func UserActions() http.HandlerFunc {
|
||||||
templates.Redirect(w, "/u/"+user.Username)
|
templates.Redirect(w, "/u/"+user.Username)
|
||||||
|
|
||||||
// Log the change.
|
// 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
|
return
|
||||||
}
|
}
|
||||||
case "promote":
|
case "promote":
|
||||||
|
@ -177,7 +177,7 @@ func UserActions() http.HandlerFunc {
|
||||||
templates.Redirect(w, "/u/"+user.Username)
|
templates.Redirect(w, "/u/"+user.Username)
|
||||||
|
|
||||||
// Log the change.
|
// 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
|
return
|
||||||
}
|
}
|
||||||
case "delete":
|
case "delete":
|
||||||
|
|
|
@ -33,6 +33,11 @@ const (
|
||||||
// Certification photos.
|
// Certification photos.
|
||||||
ChangeLogApproved = "approved"
|
ChangeLogApproved = "approved"
|
||||||
ChangeLogRejected = "rejected"
|
ChangeLogRejected = "rejected"
|
||||||
|
|
||||||
|
// Account status updates for easier filtering.
|
||||||
|
ChangeLogBanned = "banned"
|
||||||
|
ChangeLogAdmin = "admin" // admin status toggle
|
||||||
|
ChangeLogLifecycle = "lifecycle" // de/reactivated accounts
|
||||||
)
|
)
|
||||||
|
|
||||||
var ChangeLogEventTypes = []string{
|
var ChangeLogEventTypes = []string{
|
||||||
|
@ -41,6 +46,9 @@ var ChangeLogEventTypes = []string{
|
||||||
ChangeLogDeleted,
|
ChangeLogDeleted,
|
||||||
ChangeLogApproved,
|
ChangeLogApproved,
|
||||||
ChangeLogRejected,
|
ChangeLogRejected,
|
||||||
|
ChangeLogBanned,
|
||||||
|
ChangeLogAdmin,
|
||||||
|
ChangeLogLifecycle,
|
||||||
}
|
}
|
||||||
|
|
||||||
// PaginateChangeLog lists the change logs.
|
// PaginateChangeLog lists the change logs.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user