fix: project and app change (#1395)

* fix: project and app change

* fix: project and app change
This commit is contained in:
Fabi 2021-03-09 09:22:08 +01:00 committed by GitHub
parent e163ea75cd
commit 2fa4f1f9b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -168,7 +168,7 @@ func (p *Project) AppendEvent(event *es_models.Event) error {
}
func (p *Project) AppendAddProjectEvent(event *es_models.Event) error {
p.setData(event)
p.SetData(event)
p.State = int32(model.ProjectStateActive)
return nil
}
@ -188,7 +188,7 @@ func (p *Project) appendRemovedEvent() error {
return nil
}
func (p *Project) setData(event *es_models.Event) error {
func (p *Project) SetData(event *es_models.Event) error {
if err := json.Unmarshal(event.Data, p); err != nil {
logging.Log("EVEN-lo9sr").WithError(err).Error("could not unmarshal event data")
return err

View File

@ -179,7 +179,10 @@ func (a *ApplicationView) AppendEvent(event *models.Event) (err error) {
case es_model.APIConfigChanged:
return a.SetData(event)
case es_model.ProjectChanged:
return a.SetData(event)
project := &es_model.Project{}
project.SetData(event)
a.ProjectRoleAssertion = project.ProjectRoleAssertion
a.ProjectRoleCheck = project.ProjectRoleAssertion
case es_model.ApplicationDeactivated:
a.State = int32(model.AppStateInactive)
case es_model.ApplicationReactivated: