diff --git a/app/api/controller/pullreq/label_assign.go b/app/api/controller/pullreq/label_assign.go index 63afee6995..471d6eaa3e 100644 --- a/app/api/controller/pullreq/label_assign.go +++ b/app/api/controller/pullreq/label_assign.go @@ -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, diff --git a/app/api/controller/pullreq/label_unassign.go b/app/api/controller/pullreq/label_unassign.go index 6c81ecf9ac..7d0de616b1 100644 --- a/app/api/controller/pullreq/label_unassign.go +++ b/app/api/controller/pullreq/label_unassign.go @@ -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, diff --git a/app/services/label/label.go b/app/services/label/label.go index 345f06109d..db6cb96188 100644 --- a/app/services/label/label.go +++ b/app/services/label/label.go @@ -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 } } diff --git a/types/pullreq_activity_payload.go b/types/pullreq_activity_payload.go index a3c03818ff..2a9070e00c 100644 --- a/types/pullreq_activity_payload.go +++ b/types/pullreq_activity_payload.go @@ -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"`