diff --git a/internal/app/issue/issue_handler_events.go b/internal/app/issue/issue_handler_events.go index a8bc7571..b385af86 100644 --- a/internal/app/issue/issue_handler_events.go +++ b/internal/app/issue/issue_handler_events.go @@ -4,12 +4,14 @@ package issue import ( + "time" + + "github.com/cloudoperators/heureka/internal/app/common" "github.com/cloudoperators/heureka/internal/app/event" "github.com/cloudoperators/heureka/internal/app/shared" "github.com/cloudoperators/heureka/internal/database" "github.com/cloudoperators/heureka/internal/entity" "github.com/sirupsen/logrus" - "time" ) const ( @@ -168,9 +170,18 @@ func createIssueMatches( continue } + user, err := common.GetCurrentUserId(db) + if err != nil { + l.WithField("event-step", "GetCurrentUserId").WithError(err).Error("Error while getting current user ID") + continue + } + // Create new issue match issue_match := &entity.IssueMatch{ - UserId: 1, + Metadata: entity.Metadata{ + CreatedBy: user, + }, + UserId: user, Status: entity.IssueMatchStatusValuesNew, Severity: issueVariantMap[issueId].Severity, //we got two simply take the first one ComponentInstanceId: componentInstanceId, diff --git a/internal/app/issue/issue_handler_events_test.go b/internal/app/issue/issue_handler_events_test.go index febf9f72..e6422882 100644 --- a/internal/app/issue/issue_handler_events_test.go +++ b/internal/app/issue/issue_handler_events_test.go @@ -102,6 +102,7 @@ var _ = Describe("OnComponentVersionAttachmentToIssue", Label("app", "ComponentV ComponentInstanceId: componentInstance.Id, IssueId: issueEntity.Id, } + db.On("GetAllUserIds", mock.Anything).Return([]int64{1}, nil) db.On("CreateIssueMatch", matchIssueMatch(expectedMatch)).Return(expectedMatch, nil) // Emit event