mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	added the ability to set labels on the "edit pull request" api (#5347)
Signed-off-by: Lucien Kerl <lucien.kerl@wuerth-it.com>
This commit is contained in:
		@@ -405,6 +405,18 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if ctx.Repo.IsWriter() && (form.Labels != nil && len(form.Labels) > 0) {
 | 
				
			||||||
 | 
							labels, err := models.GetLabelsInRepoByIDs(ctx.Repo.Repository.ID, form.Labels)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								ctx.Error(500, "GetLabelsInRepoByIDsError", err)
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if err = issue.ReplaceLabels(labels, ctx.User); err != nil {
 | 
				
			||||||
 | 
								ctx.Error(500, "ReplaceLabelsError", err)
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err = models.UpdateIssue(issue); err != nil {
 | 
						if err = models.UpdateIssue(issue); err != nil {
 | 
				
			||||||
		ctx.Error(500, "UpdateIssue", err)
 | 
							ctx.Error(500, "UpdateIssue", err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user