Monorepo for Tangled

appview/pulls: directly pass diff and diff opts into main PR page

Signed-off-by: oppiliappan <me@oppi.li>

authored by oppi.li and committed by tangled.org f2f6c80b 6a123c31

+16 -5
+2
appview/pages/pages.go
··· 1110 MergeCheck types.MergeCheckResponse 1111 ResubmitCheck ResubmitResult 1112 Pipelines map[string]models.Pipeline 1113 1114 OrderedReactionKinds []models.ReactionKind 1115 Reactions map[models.ReactionKind]models.ReactionDisplayData
··· 1110 MergeCheck types.MergeCheckResponse 1111 ResubmitCheck ResubmitResult 1112 Pipelines map[string]models.Pipeline 1113 + Diff *types.NiceDiff 1114 + DiffOpts types.DiffOpts 1115 1116 OrderedReactionKinds []models.ReactionKind 1117 Reactions map[models.ReactionKind]models.ReactionDisplayData
+1 -1
appview/pages/templates/layouts/repobase.html
··· 1 {{ define "title" }}{{ .RepoInfo.FullName }}{{ end }} 2 3 {{ define "content" }} 4 - <section id="repo-header" class="mb-4 p-2 dark:text-white"> 5 <div class="text-lg flex flex-col sm:flex-row items-start gap-4 justify-between"> 6 <!-- left items --> 7 <div class="flex flex-col gap-2">
··· 1 {{ define "title" }}{{ .RepoInfo.FullName }}{{ end }} 2 3 {{ define "content" }} 4 + <section id="repo-header" class="mb-2 py-2 px-4 dark:text-white"> 5 <div class="text-lg flex flex-col sm:flex-row items-start gap-4 justify-between"> 6 <!-- left items --> 7 <div class="flex flex-col gap-2">
+11 -2
appview/pulls/pulls.go
··· 236 defs[l.AtUri().String()] = &l 237 } 238 239 - s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ 240 LoggedInUser: user, 241 RepoInfo: s.repoResolver.GetRepoInfo(r, user), 242 Pull: pull, ··· 247 MergeCheck: mergeCheckResponse, 248 ResubmitCheck: resubmitResult, 249 Pipelines: m, 250 251 OrderedReactionKinds: models.OrderedReactionKinds, 252 Reactions: reactionMap, 253 UserReacted: userReactions, 254 255 LabelDefs: defs, 256 - }) 257 } 258 259 func (s *Pulls) mergeCheck(r *http.Request, f *models.Repo, pull *models.Pull, stack models.Stack) types.MergeCheckResponse {
··· 236 defs[l.AtUri().String()] = &l 237 } 238 239 + patch := pull.LatestSubmission().CombinedPatch() 240 + diff := patchutil.AsNiceDiff(patch, pull.TargetBranch) 241 + var diffOpts types.DiffOpts 242 + if d := r.URL.Query().Get("diff"); d == "split" { 243 + diffOpts.Split = true 244 + } 245 + 246 + log.Println(s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ 247 LoggedInUser: user, 248 RepoInfo: s.repoResolver.GetRepoInfo(r, user), 249 Pull: pull, ··· 254 MergeCheck: mergeCheckResponse, 255 ResubmitCheck: resubmitResult, 256 Pipelines: m, 257 + Diff: &diff, 258 + DiffOpts: diffOpts, 259 260 OrderedReactionKinds: models.OrderedReactionKinds, 261 Reactions: reactionMap, 262 UserReacted: userReactions, 263 264 LabelDefs: defs, 265 + })) 266 } 267 268 func (s *Pulls) mergeCheck(r *http.Request, f *models.Repo, pull *models.Pull, stack models.Stack) types.MergeCheckResponse {
+2 -2
spindle/models/models.go
··· 53 StatusKindRunning, 54 } 55 FinishStates [4]StatusKind = [4]StatusKind{ 56 - StatusKindCancelled, 57 StatusKindFailed, 58 - StatusKindSuccess, 59 StatusKindTimeout, 60 } 61 ) 62
··· 53 StatusKindRunning, 54 } 55 FinishStates [4]StatusKind = [4]StatusKind{ 56 StatusKindFailed, 57 StatusKindTimeout, 58 + StatusKindCancelled, 59 + StatusKindSuccess, 60 } 61 ) 62