aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues/issue_project.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issues/issue_project.go')
-rw-r--r--models/issues/issue_project.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/models/issues/issue_project.go b/models/issues/issue_project.go
index 8e559f13c9..c9f4c9f533 100644
--- a/models/issues/issue_project.go
+++ b/models/issues/issue_project.go
@@ -125,13 +125,17 @@ func ChangeProjectAssign(issue *Issue, doer *user_model.User, newProjectID int64
func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *user_model.User, newProjectID int64) error {
oldProjectID := issue.projectID(ctx)
+ if err := issue.LoadRepo(ctx); err != nil {
+ return err
+ }
+
// Only check if we add a new project and not remove it.
if newProjectID > 0 {
newProject, err := project_model.GetProjectByID(ctx, newProjectID)
if err != nil {
return err
}
- if newProject.RepoID != issue.RepoID {
+ if newProject.RepoID != issue.RepoID && newProject.OwnerID != issue.Repo.OwnerID {
return fmt.Errorf("issue's repository is not the same as project's repository")
}
}
@@ -140,10 +144,6 @@ func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *user_model.U
return err
}
- if err := issue.LoadRepo(ctx); err != nil {
- return err
- }
-
if oldProjectID > 0 || newProjectID > 0 {
if _, err := CreateComment(ctx, &CreateCommentOptions{
Type: CommentTypeProject,