mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-06 05:22:13 +00:00
fix: editorname (#281)
* feat: editorname on changes * feat: editorname on changes * feat: editorname on changes * feat: editorname on changes * fix: tests * fix: tests
This commit is contained in:
@@ -2,6 +2,7 @@ package eventstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
usr_es "github.com/caos/zitadel/internal/user/repository/eventsourcing"
|
||||
"strings"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/auth"
|
||||
@@ -17,8 +18,9 @@ import (
|
||||
type OrgRepository struct {
|
||||
SearchLimit uint64
|
||||
*org_es.OrgEventstore
|
||||
View *mgmt_view.View
|
||||
Roles []string
|
||||
UserEvents *usr_es.UserEventstore
|
||||
View *mgmt_view.View
|
||||
Roles []string
|
||||
}
|
||||
|
||||
func (repo *OrgRepository) OrgByID(ctx context.Context, id string) (*org_model.OrgView, error) {
|
||||
@@ -83,6 +85,13 @@ func (repo *OrgRepository) OrgChanges(ctx context.Context, id string, lastSequen
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, change := range changes.Changes {
|
||||
change.ModifierName = change.ModifierId
|
||||
user, _ := repo.UserEvents.UserByID(ctx, change.ModifierId)
|
||||
if user != nil {
|
||||
change.ModifierName = user.DisplayName
|
||||
}
|
||||
}
|
||||
return changes, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/sdk"
|
||||
es_proj_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||
usr_event "github.com/caos/zitadel/internal/user/repository/eventsourcing"
|
||||
usr_grant_model "github.com/caos/zitadel/internal/usergrant/model"
|
||||
usr_grant_event "github.com/caos/zitadel/internal/usergrant/repository/eventsourcing"
|
||||
|
||||
@@ -28,6 +29,7 @@ type ProjectRepo struct {
|
||||
SearchLimit uint64
|
||||
ProjectEvents *proj_event.ProjectEventstore
|
||||
UserGrantEvents *usr_grant_event.UserGrantEventStore
|
||||
UserEvents *usr_event.UserEventstore
|
||||
View *view.View
|
||||
Roles []string
|
||||
}
|
||||
@@ -190,6 +192,13 @@ func (repo *ProjectRepo) ProjectChanges(ctx context.Context, id string, lastSequ
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, change := range changes.Changes {
|
||||
change.ModifierName = change.ModifierId
|
||||
user, _ := repo.UserEvents.UserByID(ctx, change.ModifierId)
|
||||
if user != nil {
|
||||
change.ModifierName = user.DisplayName
|
||||
}
|
||||
}
|
||||
return changes, nil
|
||||
}
|
||||
|
||||
@@ -241,6 +250,13 @@ func (repo *ProjectRepo) ApplicationChanges(ctx context.Context, id string, appI
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, change := range changes.Changes {
|
||||
change.ModifierName = change.ModifierId
|
||||
user, _ := repo.UserEvents.UserByID(ctx, change.ModifierId)
|
||||
if user != nil {
|
||||
change.ModifierName = user.DisplayName
|
||||
}
|
||||
}
|
||||
return changes, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,13 @@ func (repo *UserRepo) UserChanges(ctx context.Context, id string, lastSequence u
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, change := range changes.Changes {
|
||||
change.ModifierName = change.ModifierId
|
||||
user, _ := repo.UserEvents.UserByID(ctx, change.ModifierId)
|
||||
if user != nil {
|
||||
change.ModifierName = user.DisplayName
|
||||
}
|
||||
}
|
||||
return changes, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user