Monorepo for Tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

hats in PR interface

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

+54 -25
+5 -3
appview/pages/pages.go
··· 1251 1251 Stacks []models.Stack 1252 1252 Pipelines map[string]models.Pipeline 1253 1253 LabelDefs map[string]*models.LabelDefinition 1254 - Page pagination.Page 1255 - PullCount int 1254 + Page pagination.Page 1255 + PullCount int 1256 + VouchRelationships map[string]*models.VouchRelationship 1256 1257 } 1257 1258 1258 1259 func (p *Pages) RepoPulls(w io.Writer, params RepoPullsParams) error { ··· 1297 1298 Reactions map[models.ReactionKind]models.ReactionDisplayData 1298 1299 UserReacted map[models.ReactionKind]bool 1299 1300 1300 - LabelDefs map[string]*models.LabelDefinition 1301 + LabelDefs map[string]*models.LabelDefinition 1302 + VouchRelationships map[string]*models.VouchRelationship 1301 1303 } 1302 1304 1303 1305 func (p *Pages) RepoSinglePull(w io.Writer, params RepoSinglePullParams) error {
+2 -1
appview/pages/templates/repo/pulls/fragments/pullHeader.html
··· 11 11 {{ template "repo/pulls/fragments/pullState" .Pull.State }} 12 12 <span class="text-gray-500 dark:text-gray-400 text-sm flex flex-wrap items-center gap-1"> 13 13 opened by 14 - {{ template "user/fragments/picHandleLink" .Pull.OwnerDid }} 14 + {{ template "user/fragments/picLink" (list .Pull.OwnerDid "size-6" (index .VouchRelationships .Pull.OwnerDid)) }} 15 + <a href="/{{ resolve .Pull.OwnerDid }}">{{ resolve .Pull.OwnerDid }}</a> 15 16 <span class="select-none before:content-['\00B7']"></span> 16 17 {{ template "repo/fragments/time" .Pull.Created }} 17 18
+10 -8
appview/pages/templates/repo/pulls/pull.html
··· 300 300 flex gap-2 sticky top-0 z-20"> 301 301 <!-- left column: just profile picture --> 302 302 <div class="flex-shrink-0 pt-2"> 303 - {{ template "user/fragments/picLink" (list $root.Pull.OwnerDid "size-8") }} 303 + {{ template "user/fragments/picLink" (list $root.Pull.OwnerDid "size-8" (index $root.VouchRelationships $root.Pull.OwnerDid)) }} 304 304 </div> 305 305 <!-- right column --> 306 306 <div class="flex-1 min-w-0 flex flex-col gap-1"> ··· 592 592 </summary> 593 593 <div> 594 594 {{ range $item.Comments }} 595 - {{ template "submissionComment" . }} 595 + {{ template "submissionComment" (list . $root) }} 596 596 {{ end }} 597 597 </div> 598 598 {{ if gt $c 0}} ··· 625 625 {{ end }} 626 626 627 627 {{ define "submissionComment" }} 628 - <div id="comment-{{.ID}}" class="flex gap-2 -ml-4 py-4 w-full mx-auto group/comment"> 628 + {{ $comment := index . 0 }} 629 + {{ $root := index . 1 }} 630 + <div id="comment-{{$comment.ID}}" class="flex gap-2 -ml-4 py-4 w-full mx-auto group/comment"> 629 631 <!-- left column: profile picture --> 630 632 <div class="flex-shrink-0 h-fit relative"> 631 - {{ template "user/fragments/picLink" (list .OwnerDid "size-8") }} 633 + {{ template "user/fragments/picLink" (list $comment.OwnerDid "size-8" (index $root.VouchRelationships $comment.OwnerDid)) }} 632 634 </div> 633 635 <!-- right column: name and body in two rows --> 634 636 <div class="flex-1 min-w-0"> 635 637 <!-- Row 1: Author and timestamp --> 636 638 <div class="text-sm text-gray-500 dark:text-gray-400 flex items-center gap-1 group-target/comment:bg-yellow-200/30 group-target/comment:dark:bg-yellow-600/30"> 637 - {{ $handle := resolve .OwnerDid }} 639 + {{ $handle := resolve $comment.OwnerDid }} 638 640 <a class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" href="/{{ $handle }}">{{ $handle }}</a> 639 641 <span class="before:content-['·']"></span> 640 - <a class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" href="#comment-{{.ID}}"> 641 - {{ template "repo/fragments/shortTime" .Created }} 642 + <a class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" href="#comment-{{$comment.ID}}"> 643 + {{ template "repo/fragments/shortTime" $comment.Created }} 642 644 </a> 643 645 </div> 644 646 <!-- Row 2: Body text --> 645 647 <div class="prose dark:prose-invert mt-1"> 646 - {{ .Body | markdown }} 648 + {{ $comment.Body | markdown }} 647 649 </div> 648 650 </div> 649 651 </div>
+3 -2
appview/pages/templates/repo/pulls/pulls.html
··· 81 81 </div> 82 82 <div class="text-sm text-gray-500 dark:text-gray-400 flex flex-wrap items-center gap-1"> 83 83 {{ template "repo/pulls/fragments/pullState" $topPR.State }} 84 - <span class="ml-1"> 85 - {{ template "user/fragments/picHandleLink" $topPR.OwnerDid }} 84 + <span class="ml-1 flex items-center gap-1"> 85 + {{ template "user/fragments/picLink" (list $topPR.OwnerDid "size-6" (index $.VouchRelationships $topPR.OwnerDid)) }} 86 + <a href="/{{ resolve $topPR.OwnerDid }}">{{ resolve $topPR.OwnerDid }}</a> 86 87 </span> 87 88 88 89 <span class="before:content-['·']">
+1 -1
appview/pages/templates/user/fragments/picLink.html
··· 24 24 /> 25 25 {{ if $vouchRelation }} 26 26 {{ if ne $did $vouchRelation.ViewerDid }} 27 - <span class="absolute -bottom-0.5 -right-0.5 w-2/3 h-2/3" title="{{ template "user/fragments/vouchTooltip" $vouchRelation }}"> 27 + <span class="absolute -bottom-0.5 -right-0.5 w-1/2 h-1/2" title="{{ template "user/fragments/vouchTooltip" $vouchRelation }}"> 28 28 {{ if $isVouched }} 29 29 {{ template "fragments/icons/shield-check" "w-full h-full" }} 30 30 {{ else if $isDenounced }}
+5 -5
appview/pages/templates/user/fragments/vouchTooltip.html
··· 3 3 {{- if not $vr.IsEmpty -}} 4 4 {{- $networkPart := "" -}} 5 5 {{- if and (gt $vr.VouchStrength 0) (eq $vr.DenounceStrength 0) -}} 6 - {{- $networkPart = printf "%s from your network vouched for this user" (plural $vr.VouchStrength "person" "people") -}} 6 + {{- $networkPart = printf "%s from your network vouched for this user." (plural $vr.VouchStrength "person" "people") -}} 7 7 {{- else if and (gt $vr.DenounceStrength 0) (eq $vr.VouchStrength 0) -}} 8 - {{- $networkPart = printf "%s from your network denounced this user" (plural $vr.DenounceStrength "person" "people") -}} 8 + {{- $networkPart = printf "%s from your network denounced this user." (plural $vr.DenounceStrength "person" "people") -}} 9 9 {{- else if and (eq $vr.DenounceStrength 0) (eq $vr.VouchStrength 0) -}} 10 10 {{- $networkPart = "" -}} 11 11 {{- else -}} 12 - {{- $networkPart = printf "%s and %s from your network" (plural $vr.VouchStrength "vouch" "vouches") (plural $vr.DenounceStrength "denounce" "") -}} 12 + {{- $networkPart = printf "%s and %s from your network." (plural $vr.VouchStrength "vouch" "vouches") (plural $vr.DenounceStrength "denounce" "") -}} 13 13 {{- end -}} 14 14 {{- $direct := $vr.GetDirectVouch -}} 15 15 {{- if $direct -}} 16 16 {{- if $direct.IsVouch -}} 17 - You vouched for {{ resolve $vr.SubjectDid }} {{ relTimeFmt $direct.CreatedAt }}. {{ $networkPart }}. 17 + You vouched for {{ resolve $vr.SubjectDid }} {{ relTimeFmt $direct.CreatedAt }}. {{ $networkPart }} 18 18 {{- else -}} 19 - You denounced {{ resolve $vr.SubjectDid }} {{ relTimeFmt $direct.CreatedAt }}. {{ $networkPart }}. 19 + You denounced {{ resolve $vr.SubjectDid }} {{ relTimeFmt $direct.CreatedAt }}. {{ $networkPart }} 20 20 {{- end -}} 21 21 {{- else -}} 22 22 {{- $networkPart -}}.
+28 -5
appview/pulls/pulls.go
··· 266 266 defs[l.AtUri().String()] = &l 267 267 } 268 268 269 + vouchRelationships := make(map[string]*models.VouchRelationship) 270 + if user != nil { 271 + participants := pull.Participants() 272 + vouchRelationships, err = db.GetVouchRelationshipsBatch(s.db, user.Did, participants) 273 + if err != nil { 274 + l.Error("failed to fetch vouch relationships", "err", err) 275 + } 276 + } 277 + 269 278 patch := pull.Submissions[roundIdInt].CombinedPatch() 270 279 var diff types.DiffRenderer 271 280 diff = patchutil.AsNiceDiff(patch, pull.TargetBranch) ··· 306 315 Reactions: reactionMap, 307 316 UserReacted: userReactions, 308 317 309 - LabelDefs: defs, 318 + LabelDefs: defs, 319 + VouchRelationships: vouchRelationships, 310 320 }) 311 321 } 312 322 ··· 782 792 filterState = state.String() 783 793 } 784 794 795 + vouchRelationships := make(map[string]*models.VouchRelationship) 796 + if user != nil { 797 + dids := make([]string, len(pulls)) 798 + for i, p := range pulls { 799 + dids[i] = p.OwnerDid 800 + } 801 + vouchRelationships, err = db.GetVouchRelationshipsBatch(s.db, user.Did, dids) 802 + if err != nil { 803 + l.Error("failed to fetch vouch relationships", "err", err) 804 + } 805 + } 806 + 785 807 s.pages.RepoPulls(w, pages.RepoPullsParams{ 786 808 LoggedInUser: s.oauth.GetMultiAccountUser(r), 787 809 RepoInfo: repoInfo, ··· 789 811 LabelDefs: defs, 790 812 FilterState: filterState, 791 813 FilterQuery: query.String(), 792 - Stacks: stacks, 793 - Pipelines: m, 794 - Page: page, 795 - PullCount: totalPulls, 814 + Stacks: stacks, 815 + Pipelines: m, 816 + Page: page, 817 + PullCount: totalPulls, 818 + VouchRelationships: vouchRelationships, 796 819 }) 797 820 } 798 821