Add label scope to label activity (#2545)

* Add label scope to label activity
pull/3545/head
Darko Draskovic 2024-08-20 13:54:43 +00:00 committed by Harness
parent 516fd5c1ca
commit 0952d00a31
4 changed files with 6 additions and 0 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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
}
}

View File

@ -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"`