Track user block/unblock activity event (#865)

This commit is contained in:
Misha Bragin 2023-05-17 09:54:20 +02:00 committed by GitHub
parent db69a0cf9d
commit 6e9f7531f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -565,6 +565,14 @@ func (am *DefaultAccountManager) SaveUser(accountID, initiatorUserID string, upd
} }
defer func() { defer func() {
if oldUser.IsBlocked() != update.IsBlocked() {
if update.IsBlocked() {
am.storeEvent(initiatorUserID, oldUser.Id, accountID, activity.UserBlocked, nil)
} else {
am.storeEvent(initiatorUserID, oldUser.Id, accountID, activity.UserUnblocked, nil)
}
}
// store activity logs // store activity logs
if oldUser.Role != newUser.Role { if oldUser.Role != newUser.Role {
am.storeEvent(initiatorUserID, oldUser.Id, accountID, activity.UserRoleUpdated, map[string]any{"role": newUser.Role}) am.storeEvent(initiatorUserID, oldUser.Id, accountID, activity.UserRoleUpdated, map[string]any{"role": newUser.Role})