Monorepo for Tangled tangled.org
858
fork

Configure Feed

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

appview: issues: filter issues by clicking a label #283

open opened by nove-b.dev targeting master from nove-b.dev/tangled-core: href-issue-label

When contributing to a project, it's common to start by browsing issues with a label like "good-first-issue". Clicking a label to automatically filter issues by that label makes this workflow more convenient.

When a label is clicked, a query parameter is appended to the URL to filter the issue listing.

Closes #499

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:2atly2y5kfyjcj5zap6pv4wd/sh.tangled.repo.pull/3mkpenmah6d22
+32 -3
Diff #1
+12 -1
appview/issues/issues.go
··· 7 7 "fmt" 8 8 "log/slog" 9 9 "net/http" 10 + "strings" 10 11 "time" 11 12 12 13 comatproto "github.com/bluesky-social/indigo/api/atproto" ··· 1002 1003 l.Error("failed to fetch vouch relationships", "err", err) 1003 1004 } 1004 1005 } 1005 - 1006 + baseFilterParts := make([]string, 0, len(query.Items())) 1007 + for _, item := range query.Items() { 1008 + if item.Kind == searchquery.KindTagValue { 1009 + if item.Key == "label" || !searchquery.KnownTags[item.Key] { 1010 + continue 1011 + } 1012 + } 1013 + baseFilterParts = append(baseFilterParts, item.Raw) 1014 + } 1015 + baseFilterQuery := strings.Join(baseFilterParts, " ") 1006 1016 rp.pages.RepoIssues(w, pages.RepoIssuesParams{ 1007 1017 LoggedInUser: rp.oauth.GetMultiAccountUser(r), 1008 1018 RepoInfo: repoInfo, ··· 1011 1021 LabelDefs: defs, 1012 1022 FilterState: filterState, 1013 1023 FilterQuery: query.String(), 1024 + BaseFilterQuery: baseFilterQuery, 1014 1025 Page: page, 1015 1026 VouchRelationships: vouchRelationships, 1016 1027 })
+1
appview/pages/pages.go
··· 1151 1151 Page pagination.Page 1152 1152 FilterState string 1153 1153 FilterQuery string 1154 + BaseFilterQuery string 1154 1155 VouchRelationships map[syntax.DID]*models.VouchRelationship 1155 1156 } 1156 1157
+15
appview/pages/templates/labels/fragments/label.html
··· 2 2 {{ $d := .def }} 3 3 {{ $v := .val }} 4 4 {{ $withPrefix := .withPrefix }} 5 + {{ $baseFilterQuery := .baseFilterQuery }} 6 + {{ $basePath := .basePath }} 5 7 6 8 {{ $lhs := printf "%s" $d.Name }} 7 9 {{ $rhs := "" }} ··· 31 33 {{ template "repo/fragments/colorBall" (dict "color" $d.GetColor) }} 32 34 {{ printf "%s%s" $lhs $rhs }} 33 35 </a> 36 + {{ else if $basePath }} 37 + {{ $filterToken := printf "label:%s" $d.Name }} 38 + {{ if not $d.ValueType.IsNull }} 39 + {{ $filterToken = printf "%s:%s" $d.Name $v }} 40 + {{ end }} 41 + {{ $fullQuery := $filterToken }} 42 + {{ if ne $baseFilterQuery "" }} 43 + {{ $fullQuery = printf "%s %s" $baseFilterQuery $filterToken }} 44 + {{ end }} 45 + <a href="{{ $basePath }}?q={{ urlquery $fullQuery }}" class="{{ $chipClasses }}"> 46 + {{ template "repo/fragments/colorBall" (dict "color" $d.GetColor) }} 47 + {{ printf "%s%s" $lhs $rhs }} 48 + </a> 34 49 {{ else }} 35 50 <span class="{{ $chipClasses }}"> 36 51 {{ template "repo/fragments/colorBall" (dict "color" $d.GetColor) }}
+1 -1
appview/pages/templates/repo/issues/fragments/issueListing.html
··· 46 46 {{ $state := .Labels }} 47 47 {{ range $k, $d := $.LabelDefs }} 48 48 {{ range $v, $s := $state.GetValSet $d.AtUri.String }} 49 - {{ template "labels/fragments/label" (dict "def" $d "val" $v "withPrefix" true) }} 49 + {{ template "labels/fragments/label" (dict "def" $d "val" $v "withPrefix" true "baseFilterQuery" $.BaseFilterQuery "basePath" $.BasePath) }} 50 50 {{ end }} 51 51 {{ end }} 52 52 </div>
+3 -1
appview/pages/templates/repo/issues/issues.html
··· 71 71 "RepoPrefix" .RepoInfo.FullName 72 72 "LabelDefs" .LabelDefs 73 73 "VouchRelationships" .VouchRelationships 74 - ) }} 74 + "BaseFilterQuery" $.BaseFilterQuery 75 + "BasePath" (printf "/%s/issues" .RepoInfo.FullName)) 76 + }} 75 77 </div> 76 78 {{if gt .IssueCount .Page.Limit }} 77 79 {{ template "fragments/pagination" (dict

History

5 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
appview: issues: filter issues by label on click
merge conflicts detected
expand
  • appview/issues/issues.go:7
  • appview/pages/pages.go:1172
  • appview/pages/templates/labels/fragments/label.html:2
  • appview/pages/templates/repo/issues/fragments/issueListing.html:46
  • appview/pages/templates/repo/issues/issues.html:71
  • appview/pages/templates/repo/pulls/pulls.html:111
expand 0 comments
1 commit
expand
appview: issues: filter issues by label on click
expand 0 comments
1 commit
expand
appview: issues: filter issues by label on click
expand 0 comments
1 commit
expand
appview: issues: filter issues by label on click
expand 0 comments
1 commit
expand
appview: issues: filter issues by label on click
expand 0 comments