From d2777444d9197c9cbb9b730fdeb2781467dc4ac9 Mon Sep 17 00:00:00 2001
From: KN4CK3R <admin@oldschoolhack.me>
Date: Thu, 22 Dec 2022 13:40:07 +0100
Subject: [PATCH] Allow empty assignees on pull request edit (#22150) (#22214)

Backport of #22150

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
---
 routers/api/v1/repo/pull.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index ebb9c0f261..a687eabfba 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -491,6 +491,11 @@ func EditPullRequest(ctx *context.APIContext) {
 	issue := pr.Issue
 	issue.Repo = ctx.Repo.Repository
 
+	if err := issue.LoadAttributes(ctx); err != nil {
+		ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
+		return
+	}
+
 	if !issue.IsPoster(ctx.Doer.ID) && !ctx.Repo.CanWrite(unit.TypePullRequests) {
 		ctx.Status(http.StatusForbidden)
 		return