diff --git a/appview/state/pull.go b/appview/state/pull.go index d43781b..c726ab4 100644 --- a/appview/state/pull.go +++ b/appview/state/pull.go @@ -1021,27 +1021,32 @@ func (s *State) ResubmitPull(w http.ResponseWriter, r *http.Request) { var ownerDid, repoName, knotName string var isSameRepo bool = pull.IsSameRepoBranch() - sourceBranch := pull.PullSource.Branch + var isPatch bool = pull.IsPatch() + targetBranch := pull.TargetBranch - recordPullSource = &tangled.RepoPull_Source{ - Branch: sourceBranch, - } + sourceBranch := "" + if !isPatch { + sourceBranch = pull.PullSource.Branch + recordPullSource = &tangled.RepoPull_Source{ + Branch: sourceBranch, + } - isPushAllowed := f.RepoInfo(s, user).Roles.IsPushAllowed() - if isSameRepo && isPushAllowed { - ownerDid = f.OwnerDid() - repoName = f.RepoName - knotName = f.Knot - } else if !isSameRepo { - sourceRepo, err := db.GetRepoByAtUri(s.db, pull.PullSource.RepoAt.String()) - if err != nil { - log.Println("failed to get source repo", err) - s.pages.Notice(w, "pull", "Failed to create pull request. Try again later.") - return + isPushAllowed := f.RepoInfo(s, user).Roles.IsPushAllowed() + if isSameRepo && isPushAllowed { + ownerDid = f.OwnerDid() + repoName = f.RepoName + knotName = f.Knot + } else if !isSameRepo && !isPatch { + sourceRepo, err := db.GetRepoByAtUri(s.db, pull.PullSource.RepoAt.String()) + if err != nil { + log.Println("failed to get source repo", err) + s.pages.Notice(w, "pull", "Failed to create pull request. Try again later.") + return + } + ownerDid = sourceRepo.Did + repoName = sourceRepo.Name + knotName = sourceRepo.Knot } - ownerDid = sourceRepo.Did - repoName = sourceRepo.Name - knotName = sourceRepo.Knot } if sourceBranch != "" && knotName != "" { @@ -1126,7 +1131,7 @@ func (s *State) ResubmitPull(w http.ResponseWriter, r *http.Request) { return } - if sourceRev == pull.Submissions[pull.LastRoundNumber()].SourceRev { + if !isPatch && sourceRev == pull.Submissions[pull.LastRoundNumber()].SourceRev { s.pages.Notice(w, "resubmit-error", "This branch has not changed since the last submission.") return }