tangled
alpha
login
or
join now
lewis.moe
/
tangled-core
forked from
tangled.org/core
1
fork
atom
Monorepo for Tangled
1
fork
atom
overview
issues
1
pulls
pipelines
appview: fix pull header template
oppi.li
10 months ago
86883026
963ece61
+40
-37
5 changed files
expand all
collapse all
unified
split
appview
db
pulls.go
pages
pages.go
templates
repo
pulls
fragments
pullHeader.html
pull.html
state
pull.go
+12
appview/db/pulls.go
···
654
654
return nil, err
655
655
}
656
656
657
657
+
var pullSourceRepo *Repo
658
658
+
if pull.PullSource != nil {
659
659
+
if pull.PullSource.RepoAt != nil {
660
660
+
pullSourceRepo, err = GetRepoByAtUri(e, pull.PullSource.RepoAt.String())
661
661
+
if err != nil {
662
662
+
log.Printf("failed to get repo by at uri: %v", err)
663
663
+
} else {
664
664
+
pull.PullSource.Repo = pullSourceRepo
665
665
+
}
666
666
+
}
667
667
+
}
668
668
+
657
669
pull.Submissions = make([]*PullSubmission, len(submissionsMap))
658
670
for _, submission := range submissionsMap {
659
671
pull.Submissions[submission.RoundNumber] = submission
+7
-8
appview/pages/pages.go
···
679
679
}
680
680
681
681
type RepoSinglePullParams struct {
682
682
-
LoggedInUser *auth.User
683
683
-
RepoInfo RepoInfo
684
684
-
Active string
685
685
-
DidHandleMap map[string]string
686
686
-
Pull *db.Pull
687
687
-
PullSourceRepo *db.Repo
688
688
-
MergeCheck types.MergeCheckResponse
689
689
-
ResubmitCheck ResubmitResult
682
682
+
LoggedInUser *auth.User
683
683
+
RepoInfo RepoInfo
684
684
+
Active string
685
685
+
DidHandleMap map[string]string
686
686
+
Pull *db.Pull
687
687
+
MergeCheck types.MergeCheckResponse
688
688
+
ResubmitCheck ResubmitResult
690
689
}
691
690
692
691
func (p *Pages) RepoSinglePull(w io.Writer, params RepoSinglePullParams) error {
+8
-8
appview/pages/templates/repo/pulls/fragments/pullHeader.html
···
43
43
</span>
44
44
{{ if not .Pull.IsPatchBased }}
45
45
<span>from
46
46
-
{{ if not .Pull.IsBranchBased }}
47
47
-
<a href="/{{ $owner }}/{{ .PullSourceRepo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .PullSourceRepo.Name }}</a>
46
46
+
{{ if .Pull.IsForkBased }}
47
47
+
{{ if .Pull.PullSource.Repo }}
48
48
+
<a href="/{{ $owner }}/{{ .Pull.PullSource.Repo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .Pull.PullSource.Repo.Name }}</a>
49
49
+
{{ else }}
50
50
+
<span class="italic">[deleted fork]</span>
51
51
+
{{ end }}
48
52
{{ end }}
49
53
50
50
-
{{ $fullRepo := .RepoInfo.FullName }}
51
51
-
{{ if not .Pull.IsBranchBased }}
52
52
-
{{ $fullRepo = printf "%s/%s" $owner .PullSourceRepo.Name }}
53
53
-
{{ end }}
54
54
<span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
55
55
-
<a href="/{{ $fullRepo }}/tree/{{ .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a>
55
55
+
{{ .Pull.PullSource.Branch }}
56
56
</span>
57
57
</span>
58
58
{{ end }}
···
67
67
</section>
68
68
69
69
70
70
-
{{ end }}
70
70
+
{{ end }}
+7
-3
appview/pages/templates/repo/pulls/pull.html
···
90
90
<div class="text-sm text-gray-500 dark:text-gray-400">
91
91
{{ if not $.Pull.IsPatchBased }}
92
92
{{ $fullRepo := $.RepoInfo.FullName }}
93
93
-
{{ if not $.Pull.IsBranchBased }}
94
94
-
{{ $fullRepo = printf "%s/%s" $owner $.PullSourceRepo.Name }}
93
93
+
{{ if $.Pull.IsForkBased }}
94
94
+
{{ if $.Pull.PullSource.Repo }}
95
95
+
{{ $fullRepo = printf "%s/%s" $owner $.Pull.PullSource.Repo.Name }}
96
96
+
<a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-500 dark:text-gray-400">{{ slice .SHA 0 8 }}</a>
97
97
+
{{ else }}
98
98
+
<span class="font-mono">{{ slice .SHA 0 8 }}</span>
99
99
+
{{ end }}
95
100
{{ end }}
96
96
-
<a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-500 dark:text-gray-400">{{ slice .SHA 0 8 }}</a>
97
101
{{ else }}
98
102
<span class="font-mono">{{ slice .SHA 0 8 }}</span>
99
103
{{ end }}
+6
-18
appview/state/pull.go
···
120
120
resubmitResult = s.resubmitCheck(f, pull)
121
121
}
122
122
123
123
-
var pullSourceRepo *db.Repo
124
124
-
if pull.PullSource != nil {
125
125
-
if pull.PullSource.RepoAt != nil {
126
126
-
pullSourceRepo, err = db.GetRepoByAtUri(s.db, pull.PullSource.RepoAt.String())
127
127
-
if err != nil {
128
128
-
log.Printf("failed to get repo by at uri: %v", err)
129
129
-
return
130
130
-
}
131
131
-
}
132
132
-
}
133
133
-
134
123
s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{
135
135
-
LoggedInUser: user,
136
136
-
RepoInfo: f.RepoInfo(s, user),
137
137
-
DidHandleMap: didHandleMap,
138
138
-
Pull: pull,
139
139
-
PullSourceRepo: pullSourceRepo,
140
140
-
MergeCheck: mergeCheckResponse,
141
141
-
ResubmitCheck: resubmitResult,
124
124
+
LoggedInUser: user,
125
125
+
RepoInfo: f.RepoInfo(s, user),
126
126
+
DidHandleMap: didHandleMap,
127
127
+
Pull: pull,
128
128
+
MergeCheck: mergeCheckResponse,
129
129
+
ResubmitCheck: resubmitResult,
142
130
})
143
131
}
144
132