Monorepo for Tangled tangled.org

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

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

oppi.li 9f21a95f 3be30b94

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