mirror of
https://github.com/harness/drone.git
synced 2025-05-04 01:11:59 +08:00
Add label scope to label activity (#2545)
* Add label scope to label activity
This commit is contained in:
parent
516fd5c1ca
commit
0952d00a31
@ -95,6 +95,7 @@ func activityPayload(out *label.AssignToPullReqOut) *types.PullRequestActivityLa
|
|||||||
return &types.PullRequestActivityLabel{
|
return &types.PullRequestActivityLabel{
|
||||||
Label: out.Label.Key,
|
Label: out.Label.Key,
|
||||||
LabelColor: out.Label.Color,
|
LabelColor: out.Label.Color,
|
||||||
|
LabelScope: out.Label.Scope,
|
||||||
Value: value,
|
Value: value,
|
||||||
ValueColor: valueColor,
|
ValueColor: valueColor,
|
||||||
OldValue: oldValue,
|
OldValue: oldValue,
|
||||||
|
@ -68,6 +68,7 @@ func (c *Controller) UnassignLabel(
|
|||||||
payload := &types.PullRequestActivityLabel{
|
payload := &types.PullRequestActivityLabel{
|
||||||
Label: label.Key,
|
Label: label.Key,
|
||||||
LabelColor: label.Color,
|
LabelColor: label.Color,
|
||||||
|
LabelScope: label.Scope,
|
||||||
Value: value,
|
Value: value,
|
||||||
ValueColor: color,
|
ValueColor: color,
|
||||||
Type: enum.LabelActivityUnassign,
|
Type: enum.LabelActivityUnassign,
|
||||||
|
@ -148,6 +148,9 @@ func (s *Service) Save(
|
|||||||
for i, value := range valuesToCreate {
|
for i, value := range valuesToCreate {
|
||||||
valuesToReturn[i] = newLabelValue(principalID, label.ID, &value.DefineValueInput)
|
valuesToReturn[i] = newLabelValue(principalID, label.ID, &value.DefineValueInput)
|
||||||
if err = s.labelValueStore.Define(ctx, valuesToReturn[i]); err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,7 @@ func (a *PullRequestActivityPayloadBranchDelete) ActivityType() enum.PullReqActi
|
|||||||
type PullRequestActivityLabel struct {
|
type PullRequestActivityLabel struct {
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
LabelColor enum.LabelColor `json:"label_color"`
|
LabelColor enum.LabelColor `json:"label_color"`
|
||||||
|
LabelScope int64 `json:"label_scope"`
|
||||||
Value *string `json:"value,omitempty"`
|
Value *string `json:"value,omitempty"`
|
||||||
ValueColor *enum.LabelColor `json:"value_color,omitempty"`
|
ValueColor *enum.LabelColor `json:"value_color,omitempty"`
|
||||||
OldValue *string `json:"old_value,omitempty"`
|
OldValue *string `json:"old_value,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user