Skip to content

Commit

Permalink
Merge pull request #2840 from makkalot/fix/cla-group-update-project-sfid
Browse files Browse the repository at this point in the history
setting missing fields in event log on creation
  • Loading branch information
wanyaland authored Apr 1, 2021
2 parents b9dd4ea + 9977146 commit 6cbf58b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion cla-backend-go/events/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (s *service) loadCLAGroup(ctx context.Context, args *LogEventArgs) error {
args.CLAGroupName = args.ClaGroupModel.ProjectName
} else {
// Did they set the CLA Group ID?
claGroupID := ""
var claGroupID string
if args.CLAGroupID != "" {
claGroupID = args.CLAGroupID
} else if args.ProjectID != "" && utils.IsUUIDv4(args.ProjectID) { // legacy parameter
Expand All @@ -205,6 +205,7 @@ func (s *service) loadCLAGroup(ctx context.Context, args *LogEventArgs) error {
}
args.ClaGroupModel = claGroupModel
args.CLAGroupName = claGroupModel.ProjectName
args.CLAGroupID = claGroupID
} else if args.ProjectSFID != "" {
projectCLAGroupModel, projectCLAGroupErr := s.combinedRepo.GetClaGroupIDForProject(args.ProjectSFID)
if projectCLAGroupErr != nil || projectCLAGroupModel == nil {
Expand Down Expand Up @@ -269,6 +270,10 @@ func (s *service) loadSFProject(ctx context.Context, args *LogEventArgs) error {
project.Parent, parentProjectID, parentProjectName)
args.ParentProjectSFID = parentProjectID
args.ParentProjectName = parentProjectName
} else if project.Foundation != nil {
// if there's no parent set the foundation as parent project
args.ParentProjectSFID = project.Foundation.ID
args.ParentProjectName = project.Foundation.Name
}
}

Expand Down
7 changes: 3 additions & 4 deletions cla-backend-go/v2/cla_groups/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ func Configure(api *operations.EasyclaAPI, service Service, v1ProjectService v1P

// Log the event
eventsService.LogEvent(&events.LogEventArgs{
EventType: events.CLAGroupUpdated,
ProjectID: claGroup.ClaGroupID,
LfUsername: authUser.UserName,
ParentProjectSFID: claGroupModel.FoundationSFID,
EventType: events.CLAGroupUpdated,
ProjectID: claGroup.ClaGroupID,
LfUsername: authUser.UserName,
EventData: &events.CLAGroupUpdatedEventData{
ClaGroupName: params.Body.ClaGroupName,
ClaGroupDescription: params.Body.ClaGroupDescription,
Expand Down

0 comments on commit 6cbf58b

Please sign in to comment.