Skip to content

Commit

Permalink
Add label scope to label activity (harness#2545)
Browse files Browse the repository at this point in the history
* Add label scope to label activity
  • Loading branch information
darkodraskovic authored and Harness committed Aug 20, 2024
1 parent 516fd5c commit 0952d00
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/api/controller/pullreq/label_assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func activityPayload(out *label.AssignToPullReqOut) *types.PullRequestActivityLa
return &types.PullRequestActivityLabel{
Label: out.Label.Key,
LabelColor: out.Label.Color,
LabelScope: out.Label.Scope,
Value: value,
ValueColor: valueColor,
OldValue: oldValue,
Expand Down
1 change: 1 addition & 0 deletions app/api/controller/pullreq/label_unassign.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (c *Controller) UnassignLabel(
payload := &types.PullRequestActivityLabel{
Label: label.Key,
LabelColor: label.Color,
LabelScope: label.Scope,
Value: value,
ValueColor: color,
Type: enum.LabelActivityUnassign,
Expand Down
3 changes: 3 additions & 0 deletions app/services/label/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ func (s *Service) Save(
for i, value := range valuesToCreate {
valuesToReturn[i] = newLabelValue(principalID, label.ID, &value.DefineValueInput)
if err = s.labelValueStore.Define(ctx, valuesToReturn[i]); err != nil {
if errors.Is(err, store.ErrDuplicate) {
return errors.Conflict("value %s already exists", valuesToReturn[i].Value)
}
return err
}
}
Expand Down
1 change: 1 addition & 0 deletions types/pullreq_activity_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (a *PullRequestActivityPayloadBranchDelete) ActivityType() enum.PullReqActi
type PullRequestActivityLabel struct {
Label string `json:"label"`
LabelColor enum.LabelColor `json:"label_color"`
LabelScope int64 `json:"label_scope"`
Value *string `json:"value,omitempty"`
ValueColor *enum.LabelColor `json:"value_color,omitempty"`
OldValue *string `json:"old_value,omitempty"`
Expand Down

0 comments on commit 0952d00

Please sign in to comment.