Monorepo for Tangled
0
fork

Configure Feed

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

hats in issues interface

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

+107 -38
+25 -9
appview/issues/issues.go
··· 141 141 defs[l.AtUri().String()] = &l 142 142 } 143 143 144 - rp.pages.RepoSingleIssue(w, pages.RepoSingleIssueParams{ 144 + err = rp.pages.RepoSingleIssue(w, pages.RepoSingleIssueParams{ 145 145 LoggedInUser: user, 146 146 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 147 147 Issue: issue, ··· 152 152 LabelDefs: defs, 153 153 VouchRelationships: vouchRelationships, 154 154 }) 155 + if err != nil { 156 + l.Error("failed to render issue", "err", err) 157 + } 155 158 } 156 159 157 160 func (rp *Issues) EditIssue(w http.ResponseWriter, r *http.Request) { ··· 988 991 } 989 992 } 990 993 994 + vouchRelationships := make(map[string]*models.VouchRelationship) 995 + if user != nil { 996 + dids := make([]string, len(issues)) 997 + for i, u := range issues { 998 + dids[i] = u.Did 999 + } 1000 + vouchRelationships, err = db.GetVouchRelationshipsBatch(rp.db, user.Did, dids) 1001 + if err != nil { 1002 + l.Error("failed to fetch vouch relationships", "err", err) 1003 + } 1004 + } 1005 + 991 1006 rp.pages.RepoIssues(w, pages.RepoIssuesParams{ 992 - LoggedInUser: rp.oauth.GetMultiAccountUser(r), 993 - RepoInfo: repoInfo, 994 - Issues: issues, 995 - IssueCount: totalIssues, 996 - LabelDefs: defs, 997 - FilterState: filterState, 998 - FilterQuery: query.String(), 999 - Page: page, 1007 + LoggedInUser: rp.oauth.GetMultiAccountUser(r), 1008 + RepoInfo: repoInfo, 1009 + Issues: issues, 1010 + IssueCount: totalIssues, 1011 + LabelDefs: defs, 1012 + FilterState: filterState, 1013 + FilterQuery: query.String(), 1014 + Page: page, 1015 + VouchRelationships: vouchRelationships, 1000 1016 }) 1001 1017 } 1002 1018
+2
appview/pages/funcmap.go
··· 24 24 "github.com/alecthomas/chroma/v2/lexers" 25 25 "github.com/alecthomas/chroma/v2/styles" 26 26 "github.com/dustin/go-humanize" 27 + "github.com/dustin/go-humanize/english" 27 28 "github.com/go-enry/go-enry/v2" 28 29 "github.com/yuin/goldmark" 29 30 emoji "github.com/yuin/goldmark-emoji" ··· 186 187 return s 187 188 }, 188 189 "commaFmt": humanize.Comma, 190 + "plural": english.Plural, 189 191 "relTimeFmt": humanize.Time, 190 192 "shortRelTimeFmt": func(t time.Time) string { 191 193 return humanize.CustomRelTime(t, time.Now(), "", "", []humanize.RelTimeMagnitude{
+10 -9
appview/pages/pages.go
··· 1106 1106 } 1107 1107 1108 1108 type RepoIssuesParams struct { 1109 - LoggedInUser *oauth.MultiAccountUser 1110 - RepoInfo repoinfo.RepoInfo 1111 - Active string 1112 - Issues []models.Issue 1113 - IssueCount int 1114 - LabelDefs map[string]*models.LabelDefinition 1115 - Page pagination.Page 1116 - FilterState string 1117 - FilterQuery string 1109 + LoggedInUser *oauth.MultiAccountUser 1110 + RepoInfo repoinfo.RepoInfo 1111 + Active string 1112 + Issues []models.Issue 1113 + IssueCount int 1114 + LabelDefs map[string]*models.LabelDefinition 1115 + Page pagination.Page 1116 + FilterState string 1117 + FilterQuery string 1118 + VouchRelationships map[string]*models.VouchRelationship 1118 1119 } 1119 1120 1120 1121 func (p *Pages) RepoIssues(w io.Writer, params RepoIssuesParams) error {
+5 -5
appview/pages/templates/fragments/icons/shield-alert.html
··· 1 1 {{ define "fragments/icons/shield-alert" }} 2 - <svg class="{{.}}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 3 - <path d="M20 13C20 18 16.5 20.5 12.34 21.95C12.1222 22.0238 11.8855 22.0202 11.67 21.94C7.5 20.5 4 18 4 13V5.99996C4 5.73474 4.10536 5.48039 4.29289 5.29285C4.48043 5.10532 4.73478 4.99996 5 4.99996C7 4.99996 9.5 3.79996 11.24 2.27996C11.4519 2.09896 11.7214 1.99951 12 1.99951C12.2786 1.99951 12.5481 2.09896 12.76 2.27996C14.51 3.80996 17 4.99996 19 4.99996C19.2652 4.99996 19.5196 5.10532 19.7071 5.29285C19.8946 5.48039 20 5.73474 20 5.99996V13Z" fill="#EF4444" stroke="#DC2626" stroke-linecap="round" stroke-linejoin="round"/> 4 - <path d="M12 8V12" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 5 - <path d="M12 16H12.01" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6 - </svg> 2 + <svg class="{{.}}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 3 + <path d="M20 13C20 18 16.5 20.5 12.34 21.95C12.1222 22.0238 11.8855 22.0202 11.67 21.94C7.5 20.5 4 18 4 13V5.99996C4 5.73474 4.10536 5.48039 4.29289 5.29285C4.48043 5.10532 4.73478 4.99996 5 4.99996C7 4.99996 9.5 3.79996 11.24 2.27996C11.4519 2.09896 11.7214 1.99951 12 1.99951C12.2786 1.99951 12.5481 2.09896 12.76 2.27996C14.51 3.80996 17 4.99996 19 4.99996C19.2652 4.99996 19.5196 5.10532 19.7071 5.29285C19.8946 5.48039 20 5.73474 20 5.99996V13Z" fill="#EF4444" stroke="#DC2626" stroke-linecap="round" stroke-linejoin="round"/> 4 + <path d="M12 8V12" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 5 + <path d="M12 16H12.01" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6 + </svg> 7 7 {{ end }}
+4 -4
appview/pages/templates/fragments/icons/shield-check.html
··· 1 1 {{ define "fragments/icons/shield-check" }} 2 - <svg class="{{.}}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 3 - <path d="M20 13C20 18 16.5 20.5 12.34 21.95C12.1222 22.0238 11.8855 22.0202 11.67 21.94C7.5 20.5 4 18 4 13V5.99996C4 5.73474 4.10536 5.48039 4.29289 5.29285C4.48043 5.10532 4.73478 4.99996 5 4.99996C7 4.99996 9.5 3.79996 11.24 2.27996C11.4519 2.09896 11.7214 1.99951 12 1.99951C12.2786 1.99951 12.5481 2.09896 12.76 2.27996C14.51 3.80996 17 4.99996 19 4.99996C19.2652 4.99996 19.5196 5.10532 19.7071 5.29285C19.8946 5.48039 20 5.73474 20 5.99996V13Z" fill="#22C55E" stroke="#16A34A" stroke-linecap="round" stroke-linejoin="round"/> 4 - <path d="M9 12L11 14L15 10" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 5 - </svg> 2 + <svg class="{{.}}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 3 + <path d="M20 13C20 18 16.5 20.5 12.34 21.95C12.1222 22.0238 11.8855 22.0202 11.67 21.94C7.5 20.5 4 18 4 13V5.99996C4 5.73474 4.10536 5.48039 4.29289 5.29285C4.48043 5.10532 4.73478 4.99996 5 4.99996C7 4.99996 9.5 3.79996 11.24 2.27996C11.4519 2.09896 11.7214 1.99951 12 1.99951C12.2786 1.99951 12.5481 2.09896 12.76 2.27996C14.51 3.80996 17 4.99996 19 4.99996C19.2652 4.99996 19.5196 5.10532 19.7071 5.29285C19.8946 5.48039 20 5.73474 20 5.99996V13Z" fill="#22C55E" stroke="#16A34A" stroke-linecap="round" stroke-linejoin="round"/> 4 + <path d="M9 12L11 14L15 10" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 5 + </svg> 6 6 {{ end }}
+5
appview/pages/templates/fragments/icons/shield.html
··· 1 + {{ define "fragments/icons/shield" }} 2 + <svg class="{{.}}" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 3 + <path d="M20 13C20 18 16.5 20.5 12.34 21.95C12.1222 22.0238 11.8855 22.0202 11.67 21.94C7.5 20.5 4 18 4 13V5.99996C4 5.73474 4.10536 5.48039 4.29289 5.29285C4.48043 5.10532 4.73478 4.99996 5 4.99996C7 4.99996 9.5 3.79996 11.24 2.27996C11.4519 2.09896 11.7214 1.99951 12 1.99951C12.2786 1.99951 12.5481 2.09896 12.76 2.27996C14.51 3.80996 17 4.99996 19 4.99996C19.2652 4.99996 19.5196 5.10532 19.7071 5.29285C19.8946 5.48039 20 5.73474 20 5.99996V13Z" fill="#F97316" stroke="#EA580C" stroke-linecap="round" stroke-linejoin="round"/> 4 + </svg> 5 + {{ end }}
+3 -2
appview/pages/templates/repo/issues/fragments/issueListing.html
··· 26 26 <span class="text-white dark:text-white text-sm">{{ $state }}</span> 27 27 </span> 28 28 29 - <span class="ml-1"> 30 - {{ template "user/fragments/picHandleLink" .Did }} 29 + <span class="ml-1 flex items-center gap-1"> 30 + {{ template "user/fragments/picLink" (list .Did "size-6" (index $.VouchRelationships .Did)) }} 31 + <a href="/{{ resolve .Did }}">{{ resolve .Did }}</a> 31 32 </span> 32 33 33 34 <span class="before:content-['·']">
+2 -1
appview/pages/templates/repo/issues/issue.html
··· 68 68 69 69 <span class="text-gray-500 dark:text-gray-400 text-sm flex flex-wrap items-center gap-1"> 70 70 opened by 71 - {{ template "user/fragments/picHandleLink" .Issue.Did }} 71 + {{ template "user/fragments/picLink" (list .Issue.Did "size-6" (index .VouchRelationships .Issue.Did)) }} 72 + <a href="/{{ resolve .Issue.Did }}">{{ resolve .Issue.Did }}</a> 72 73 <span class="select-none before:content-['\00B7']"></span> 73 74 {{ if .Issue.Edited }} 74 75 edited {{ template "repo/fragments/time" .Issue.Edited }}
+7 -1
appview/pages/templates/repo/issues/issues.html
··· 65 65 66 66 {{ define "repoAfter" }} 67 67 <div class="mt-2"> 68 - {{ template "repo/issues/fragments/issueListing" (dict "Issues" .Issues "RepoPrefix" .RepoInfo.FullName "LabelDefs" .LabelDefs) }} 68 + {{ template "repo/issues/fragments/issueListing" 69 + (dict 70 + "Issues" .Issues 71 + "RepoPrefix" .RepoInfo.FullName 72 + "LabelDefs" .LabelDefs 73 + "VouchRelationships" .VouchRelationships 74 + ) }} 69 75 </div> 70 76 {{if gt .IssueCount .Page.Limit }} 71 77 {{ template "fragments/pagination" (dict
+17 -5
appview/pages/templates/user/fragments/picLink.html
··· 4 4 {{ $handle := resolve $did }} 5 5 {{ $isVouched := false }} 6 6 {{ $isDenounced := false }} 7 + {{ $isPartial := false }} 8 + {{ $vouchRelation := false }} 7 9 {{ if ge (len .) 3 }} 8 - {{ $vouchRelation := index . 2 }} 10 + {{ $vouchRelation = index . 2 }} 9 11 {{ if $vouchRelation.IsDirectVouch }} 10 12 {{ $isVouched = true }} 11 13 {{ else if $vouchRelation.IsDirectDenounce }} 12 14 {{ $isDenounced = true }} 15 + {{ else if not $vouchRelation.IsEmpty }} 16 + {{ $isPartial = true }} 13 17 {{ end }} 14 18 {{ end }} 15 19 <a href="/{{ $handle }}" title="{{ $handle }}" class="relative inline-block"> ··· 18 22 alt="" 19 23 class="rounded-full border border-gray-300 dark:border-gray-700 {{ $classes }}" 20 24 /> 21 - {{ if $isVouched }} 22 - <span class="absolute bottom-0 right-0">{{ template "fragments/icons/shield-check" "size-4" }}</span> 23 - {{ else if $isDenounced }} 24 - <span class="absolute bottom-0 right-0">{{ template "fragments/icons/shield-alert" "size-4" }}</span> 25 + {{ if $vouchRelation }} 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 }}"> 28 + {{ if $isVouched }} 29 + {{ template "fragments/icons/shield-check" "w-full h-full" }} 30 + {{ else if $isDenounced }} 31 + {{ template "fragments/icons/shield-alert" "w-full h-full" }} 32 + {{ else if $isPartial }} 33 + {{ template "fragments/icons/shield" "w-full h-full" }} 34 + {{ end }} 35 + </span> 36 + {{ end }} 25 37 {{ end }} 26 38 </a> 27 39 {{ end }}
+25
appview/pages/templates/user/fragments/vouchTooltip.html
··· 1 + {{ define "user/fragments/vouchTooltip" }} 2 + {{- $vr := . -}} 3 + {{- if not $vr.IsEmpty -}} 4 + {{- $networkPart := "" -}} 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") -}} 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") -}} 9 + {{- else if and (eq $vr.DenounceStrength 0) (eq $vr.VouchStrength 0) -}} 10 + {{- $networkPart = "" -}} 11 + {{- else -}} 12 + {{- $networkPart = printf "%s and %s from your network" (plural $vr.VouchStrength "vouch" "vouches") (plural $vr.DenounceStrength "denounce" "") -}} 13 + {{- end -}} 14 + {{- $direct := $vr.GetDirectVouch -}} 15 + {{- if $direct -}} 16 + {{- if $direct.IsVouch -}} 17 + You vouched for {{ resolve $vr.SubjectDid }} {{ relTimeFmt $direct.CreatedAt }}. {{ $networkPart }}. 18 + {{- else -}} 19 + You denounced {{ resolve $vr.SubjectDid }} {{ relTimeFmt $direct.CreatedAt }}. {{ $networkPart }}. 20 + {{- end -}} 21 + {{- else -}} 22 + {{- $networkPart -}}. 23 + {{- end -}} 24 + {{- end -}} 25 + {{ end }}
+2 -2
flake.lock
··· 120 120 "lastModified": 1731402384, 121 121 "narHash": "sha256-OwUmrPfEehLDz0fl2ChYLK8FQM2p0G1+EMrGsYEq+6g=", 122 122 "type": "tarball", 123 - "url": "https://github.com/IBM/plex/releases/download/@ibm/plex-mono@1.1.0/ibm-plex-mono.zip" 123 + "url": "https://github.com/IBM/plex/releases/download/@ibm%2Fplex-mono@1.1.0/ibm-plex-mono.zip" 124 124 }, 125 125 "original": { 126 126 "type": "tarball", 127 - "url": "https://github.com/IBM/plex/releases/download/@ibm/plex-mono@1.1.0/ibm-plex-mono.zip" 127 + "url": "https://github.com/IBM/plex/releases/download/@ibm%2Fplex-mono@1.1.0/ibm-plex-mono.zip" 128 128 } 129 129 }, 130 130 "indigo": {