Monorepo for Tangled tangled.org
2

Configure Feed

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

appview: envelope LoggedInUser into BaseParams

down the line, BaseParams will include a bit more data, such as focus
status.

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

author
oppiliappan
committer
Tangled
date (Jun 15, 2026, 5:28 PM +0300) commit e00f9651 parent c38a4376 change-id suvmswvx
+207 -148
+4 -4
appview/issues/issues.go
··· 166 166 } 167 167 168 168 err = rp.pages.RepoSingleIssue(w, pages.RepoSingleIssueParams{ 169 - LoggedInUser: user, 169 + BaseParams: pages.BaseParamsFromContext(r.Context()), 170 170 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 171 171 Issue: issue, 172 172 CommentList: models.NewCommentList(issue.Comments), ··· 195 195 switch r.Method { 196 196 case http.MethodGet: 197 197 rp.pages.EditIssueFragment(w, pages.EditIssueParams{ 198 - LoggedInUser: user, 198 + BaseParams: pages.BaseParamsFromContext(r.Context()), 199 199 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 200 200 Issue: issue, 201 201 }) ··· 632 632 } 633 633 baseFilterQuery := strings.Join(baseFilterParts, " ") 634 634 rp.pages.RepoIssues(w, pages.RepoIssuesParams{ 635 - LoggedInUser: rp.oauth.GetMultiAccountUser(r), 635 + BaseParams: pages.BaseParamsFromContext(r.Context()), 636 636 RepoInfo: repoInfo, 637 637 Issues: issues, 638 638 IssueCount: totalIssues, ··· 660 660 switch r.Method { 661 661 case http.MethodGet: 662 662 rp.pages.RepoNewIssue(w, pages.RepoNewIssueParams{ 663 - LoggedInUser: user, 663 + BaseParams: pages.BaseParamsFromContext(r.Context()), 664 664 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 665 665 }) 666 666 case http.MethodPost:
+2 -2
appview/knots/knots.go
··· 89 89 } 90 90 91 91 k.Pages.Knots(w, pages.KnotsParams{ 92 - LoggedInUser: user, 92 + BaseParams: pages.BaseParamsFromContext(r.Context()), 93 93 Knots: knots, 94 94 }) 95 95 } ··· 141 141 } 142 142 143 143 k.Pages.Knot(w, pages.KnotParams{ 144 - LoggedInUser: user, 144 + BaseParams: pages.BaseParamsFromContext(r.Context()), 145 145 Registration: &registration, 146 146 Members: members, 147 147 Repos: repoMap,
+28
appview/middleware/middleware.go
··· 95 95 } 96 96 } 97 97 98 + func (m *Middleware) InjectBaseParams(next http.Handler) http.Handler { 99 + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 100 + user := m.oauth.GetMultiAccountUser(r) 101 + bp := pages.BaseParams{ 102 + LoggedInUser: user, 103 + } 104 + if user != nil { 105 + if focusing, _ := db.GetFocusStatus(m.db, user.Did); focusing { 106 + if item, _ := db.GetNextFocusItem(m.db, user.Did); item != nil { 107 + count, _ := db.CountFocusNotifs(m.db, user.Did) 108 + bp.FocusParams = pages.FocusParams{ 109 + Focusing: true, 110 + FocusLink: item.URL(m.idResolver), 111 + FocusNotificationID: item.ID, 112 + CurrentPath: r.URL.Path, 113 + FocusCount: int(count), 114 + } 115 + } else { 116 + // queue exhausted — auto-exit focus mode 117 + _ = db.EndFocus(m.db, user.Did) 118 + } 119 + } 120 + } 121 + ctx := pages.BaseParamsIntoContext(r.Context(), bp) 122 + next.ServeHTTP(w, r.WithContext(ctx)) 123 + }) 124 + } 125 + 98 126 func Paginate(next http.Handler) http.Handler { 99 127 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 100 128 page := pagination.FirstPage()
+2 -2
appview/notifications/notifications.go
··· 153 153 } 154 154 155 155 err = n.pages.Notifications(w, pages.NotificationsParams{ 156 - LoggedInUser: user, 156 + BaseParams: pages.BaseParamsFromContext(r.Context()), 157 157 MobileGroups: pages.GroupNotificationsByDate(notifications), 158 158 WorkGroups: pages.GroupNotificationsByDate(workNotifications), 159 159 SocialGroups: pages.GroupNotificationsByDate(socialNotifications), ··· 187 187 } 188 188 189 189 err = n.pages.NotificationPreview(w, pages.NotificationPreviewParams{ 190 - LoggedInUser: user, 190 + BaseParams: pages.BaseParamsFromContext(r.Context()), 191 191 Notifications: notifications, 192 192 ReadFilter: readFilter, 193 193 CategoryFilter: categoryFilter,
+92 -72
appview/pages/pages.go
··· 1 1 package pages 2 2 3 3 import ( 4 + "context" 4 5 "crypto/sha256" 5 6 "embed" 6 7 "encoding/hex" ··· 36 37 37 38 //go:embed templates/* static legal 38 39 var Files embed.FS 40 + 41 + type baseParamsCtxKey struct{} 42 + 43 + type BaseParams struct { 44 + LoggedInUser *oauth.MultiAccountUser 45 + } 46 + 47 + func BaseParamsIntoContext(ctx context.Context, bp BaseParams) context.Context { 48 + return context.WithValue(ctx, baseParamsCtxKey{}, bp) 49 + } 50 + 51 + func BaseParamsFromContext(ctx context.Context) BaseParams { 52 + bp, _ := ctx.Value(baseParamsCtxKey{}).(BaseParams) 53 + return bp 54 + } 39 55 40 56 type Pages struct { 41 57 mu sync.RWMutex ··· 338 354 } 339 355 340 356 type TermsOfServiceParams struct { 341 - LoggedInUser *oauth.MultiAccountUser 342 - Content template.HTML 357 + BaseParams 358 + Content template.HTML 343 359 } 344 360 345 361 func (p *Pages) TermsOfService(w io.Writer, params TermsOfServiceParams) error { ··· 367 383 } 368 384 369 385 type PrivacyPolicyParams struct { 370 - LoggedInUser *oauth.MultiAccountUser 386 + BaseParams 371 387 Content template.HTML 372 388 } 373 389 ··· 396 412 } 397 413 398 414 type BrandParams struct { 399 - LoggedInUser *oauth.MultiAccountUser 415 + BaseParams 400 416 } 401 417 402 418 func (p *Pages) Brand(w io.Writer, params BrandParams) error { ··· 418 434 } 419 435 420 436 type TimelineParams struct { 421 - LoggedInUser *oauth.MultiAccountUser 437 + BaseParams 422 438 Timeline []models.TimelineGroup 423 439 Repos []models.Repo 424 440 GfiLabel *models.LabelDefinition ··· 433 449 // anonymous visitors it is always true (dismissal falls back to 434 450 // localStorage on the client). 435 451 ShowNewsletter bool 452 + CanFocus bool 436 453 } 437 454 438 455 func (p *Pages) Timeline(w io.Writer, params TimelineParams) error { ··· 440 457 } 441 458 442 459 type GoodFirstIssuesParams struct { 443 - LoggedInUser *oauth.MultiAccountUser 460 + BaseParams 444 461 Issues []models.Issue 445 462 RepoGroups []*models.RepoGroup 446 463 LabelDefs map[string]*models.LabelDefinition ··· 453 470 } 454 471 455 472 type UserProfileSettingsParams struct { 456 - LoggedInUser *oauth.MultiAccountUser 473 + BaseParams 457 474 Tab string 458 475 PunchcardPreference models.PunchcardPreference 459 476 IsTnglSh bool ··· 492 509 } 493 510 494 511 type NotificationsParams struct { 495 - LoggedInUser *oauth.MultiAccountUser 512 + BaseParams 496 513 WorkGroups GroupedNotifications 497 514 SocialGroups GroupedNotifications 498 515 MobileGroups GroupedNotifications ··· 502 519 Total int 503 520 ReadFilter string // "inbox" or "unread" 504 521 CategoryFilter string // "all", "work", "social" 522 + CanFocus bool 505 523 } 506 524 507 525 func (p *Pages) Notifications(w io.Writer, params NotificationsParams) error { ··· 521 539 } 522 540 523 541 type NotificationPreviewParams struct { 524 - LoggedInUser *oauth.MultiAccountUser 542 + BaseParams 525 543 Notifications []*models.NotificationWithEntity 526 544 ReadFilter string 527 545 CategoryFilter string 546 + CanFocus bool 528 547 } 529 548 530 549 func (p *Pages) NotificationPreview(w io.Writer, params NotificationPreviewParams) error { 531 550 return p.executePlain("notifications/fragments/preview", w, params) 532 551 } 552 + 533 553 534 554 type UserKeysSettingsParams struct { 535 - LoggedInUser *oauth.MultiAccountUser 555 + BaseParams 536 556 PubKeys []models.PublicKey 537 557 Tab string 538 558 } ··· 543 563 } 544 564 545 565 type UserEmailsSettingsParams struct { 546 - LoggedInUser *oauth.MultiAccountUser 566 + BaseParams 547 567 Emails []models.Email 548 568 Tab string 549 569 } ··· 554 574 } 555 575 556 576 type UserNotificationSettingsParams struct { 557 - LoggedInUser *oauth.MultiAccountUser 577 + BaseParams 558 578 Preferences *models.NotificationPreferences 559 579 Tab string 560 580 } ··· 565 585 } 566 586 567 587 type UserSiteSettingsParams struct { 568 - LoggedInUser *oauth.MultiAccountUser 588 + BaseParams 569 589 Claim *models.DomainClaim 570 590 SitesDomain string 571 591 IsTnglHandle bool ··· 599 619 } 600 620 601 621 type KnotsParams struct { 602 - LoggedInUser *oauth.MultiAccountUser 622 + BaseParams 603 623 Knots []KnotListingParams 604 624 Tab string 605 625 } ··· 610 630 } 611 631 612 632 type KnotParams struct { 613 - LoggedInUser *oauth.MultiAccountUser 633 + BaseParams 614 634 Registration *models.Registration 615 635 Members []string 616 636 Repos map[string][]models.Repo ··· 633 653 } 634 654 635 655 type SpindlesParams struct { 636 - LoggedInUser *oauth.MultiAccountUser 656 + BaseParams 637 657 Spindles []models.Spindle 638 658 Tab string 639 659 } ··· 653 673 } 654 674 655 675 type SpindleDashboardParams struct { 656 - LoggedInUser *oauth.MultiAccountUser 676 + BaseParams 657 677 Spindle models.Spindle 658 678 Members []string 659 679 Repos map[string][]models.Repo ··· 665 685 } 666 686 667 687 type NewRepoParams struct { 668 - LoggedInUser *oauth.MultiAccountUser 688 + BaseParams 669 689 Knots []string 670 690 } 671 691 ··· 674 694 } 675 695 676 696 type ForkRepoParams struct { 677 - LoggedInUser *oauth.MultiAccountUser 697 + BaseParams 678 698 Knots []string 679 699 RepoInfo repoinfo.RepoInfo 680 700 } ··· 715 735 } 716 736 717 737 type ProfileOverviewParams struct { 718 - LoggedInUser *oauth.MultiAccountUser 738 + BaseParams 719 739 Repos []models.Repo 720 740 CollaboratingRepos []models.Repo 721 741 ProfileTimeline *models.ProfileTimeline ··· 730 750 } 731 751 732 752 type ProfileReposParams struct { 733 - LoggedInUser *oauth.MultiAccountUser 753 + BaseParams 734 754 Repos []models.Repo 735 755 StarStatuses map[string]bool 736 756 Card *ProfileCard ··· 746 766 } 747 767 748 768 type ProfileStarredParams struct { 749 - LoggedInUser *oauth.MultiAccountUser 769 + BaseParams 750 770 Repos []models.Repo 751 771 Card *ProfileCard 752 772 Page pagination.Page ··· 760 780 } 761 781 762 782 type ProfileStringsParams struct { 763 - LoggedInUser *oauth.MultiAccountUser 783 + BaseParams 764 784 Strings []models.String 765 785 Card *ProfileCard 766 786 Active string ··· 772 792 } 773 793 774 794 type ProfileVouchesParams struct { 775 - LoggedInUser *oauth.MultiAccountUser 795 + BaseParams 776 796 Vouches []models.Vouch 777 797 Suggestions []models.VouchSuggestion 778 798 Card *ProfileCard ··· 790 810 791 811 type FollowCard struct { 792 812 UserDid string 793 - LoggedInUser *oauth.MultiAccountUser 813 + BaseParams 794 814 FollowStatus models.FollowStatus 795 815 FollowersCount int64 796 816 FollowingCount int64 ··· 798 818 } 799 819 800 820 type ProfileFollowersParams struct { 801 - LoggedInUser *oauth.MultiAccountUser 821 + BaseParams 802 822 Followers []FollowCard 803 823 Card *ProfileCard 804 824 Active string ··· 810 830 } 811 831 812 832 type ProfileFollowingParams struct { 813 - LoggedInUser *oauth.MultiAccountUser 833 + BaseParams 814 834 Following []FollowCard 815 835 Card *ProfileCard 816 836 Active string ··· 832 852 } 833 853 834 854 type ProfilePopoverParams struct { 835 - LoggedInUser *oauth.MultiAccountUser 855 + BaseParams 836 856 UserDid string 837 857 Profile *models.Profile 838 858 FollowStatus models.FollowStatus ··· 850 870 } 851 871 852 872 type EditBioParams struct { 853 - LoggedInUser *oauth.MultiAccountUser 873 + BaseParams 854 874 Profile *models.Profile 855 875 AlsoKnownAs []string 856 876 } ··· 860 880 } 861 881 862 882 type EditPinsParams struct { 863 - LoggedInUser *oauth.MultiAccountUser 883 + BaseParams 864 884 Profile *models.Profile 865 885 AllRepos []PinnedRepo 866 886 } ··· 888 908 } 889 909 890 910 type RepoIndexParams struct { 891 - LoggedInUser *oauth.MultiAccountUser 911 + BaseParams 892 912 RepoInfo repoinfo.RepoInfo 893 913 Active string 894 914 TagMap map[string][]string ··· 942 962 } 943 963 944 964 type RepoLogParams struct { 945 - LoggedInUser *oauth.MultiAccountUser 965 + BaseParams 946 966 RepoInfo repoinfo.RepoInfo 947 967 TagMap map[string][]string 948 968 Active string ··· 959 979 } 960 980 961 981 type RepoCommitParams struct { 962 - LoggedInUser *oauth.MultiAccountUser 982 + BaseParams 963 983 RepoInfo repoinfo.RepoInfo 964 984 Active string 965 985 EmailToDid map[string]string ··· 978 998 } 979 999 980 1000 type RepoTreeParams struct { 981 - LoggedInUser *oauth.MultiAccountUser 1001 + BaseParams 982 1002 RepoInfo repoinfo.RepoInfo 983 1003 Active string 984 1004 BreadCrumbs [][]string ··· 1040 1060 } 1041 1061 1042 1062 type RepoBranchesParams struct { 1043 - LoggedInUser *oauth.MultiAccountUser 1063 + BaseParams 1044 1064 RepoInfo repoinfo.RepoInfo 1045 1065 Active string 1046 1066 types.RepoBranchesResponse ··· 1052 1072 } 1053 1073 1054 1074 type RepoTagsParams struct { 1055 - LoggedInUser *oauth.MultiAccountUser 1075 + BaseParams 1056 1076 RepoInfo repoinfo.RepoInfo 1057 1077 Active string 1058 1078 types.RepoTagsResponse ··· 1066 1086 } 1067 1087 1068 1088 type RepoTagParams struct { 1069 - LoggedInUser *oauth.MultiAccountUser 1089 + BaseParams 1070 1090 RepoInfo repoinfo.RepoInfo 1071 1091 Active string 1072 1092 types.RepoTagResponse ··· 1080 1100 } 1081 1101 1082 1102 type RepoArtifactParams struct { 1083 - LoggedInUser *oauth.MultiAccountUser 1103 + BaseParams 1084 1104 RepoInfo repoinfo.RepoInfo 1085 1105 Artifact models.Artifact 1086 1106 } ··· 1090 1110 } 1091 1111 1092 1112 type RepoBlobParams struct { 1093 - LoggedInUser *oauth.MultiAccountUser 1113 + BaseParams 1094 1114 RepoInfo repoinfo.RepoInfo 1095 1115 Active string // always "overview" 1096 1116 BreadCrumbs [][]string ··· 1113 1133 } 1114 1134 1115 1135 type RepoSettingsParams struct { 1116 - LoggedInUser *oauth.MultiAccountUser 1136 + BaseParams 1117 1137 RepoInfo repoinfo.RepoInfo 1118 1138 Collaborators []Collaborator 1119 1139 Active string ··· 1132 1152 } 1133 1153 1134 1154 type RepoGeneralSettingsParams struct { 1135 - LoggedInUser *oauth.MultiAccountUser 1155 + BaseParams 1136 1156 RepoInfo repoinfo.RepoInfo 1137 1157 Labels []models.LabelDefinition 1138 1158 DefaultLabels []models.LabelDefinition ··· 1150 1170 } 1151 1171 1152 1172 type RepoAccessSettingsParams struct { 1153 - LoggedInUser *oauth.MultiAccountUser 1173 + BaseParams 1154 1174 RepoInfo repoinfo.RepoInfo 1155 1175 Active string 1156 1176 Tab string ··· 1165 1185 } 1166 1186 1167 1187 type RepoPipelineSettingsParams struct { 1168 - LoggedInUser *oauth.MultiAccountUser 1188 + BaseParams 1169 1189 RepoInfo repoinfo.RepoInfo 1170 1190 Active string 1171 1191 Tab string ··· 1181 1201 } 1182 1202 1183 1203 type RepoWebhooksSettingsParams struct { 1184 - LoggedInUser *oauth.MultiAccountUser 1204 + BaseParams 1185 1205 RepoInfo repoinfo.RepoInfo 1186 1206 Active string 1187 1207 Tab string ··· 1196 1216 } 1197 1217 1198 1218 type WebhookDeliveriesListParams struct { 1199 - LoggedInUser *oauth.MultiAccountUser 1219 + BaseParams 1200 1220 RepoInfo repoinfo.RepoInfo 1201 1221 Webhook *models.Webhook 1202 1222 Deliveries []models.WebhookDelivery ··· 1211 1231 } 1212 1232 1213 1233 type RepoSiteSettingsParams struct { 1214 - LoggedInUser *oauth.MultiAccountUser 1234 + BaseParams 1215 1235 RepoInfo repoinfo.RepoInfo 1216 1236 Active string 1217 1237 Tab string ··· 1229 1249 } 1230 1250 1231 1251 type RepoIssuesParams struct { 1232 - LoggedInUser *oauth.MultiAccountUser 1252 + BaseParams 1233 1253 RepoInfo repoinfo.RepoInfo 1234 1254 Active string 1235 1255 Issues []models.Issue ··· 1248 1268 } 1249 1269 1250 1270 type RepoSingleIssueParams struct { 1251 - LoggedInUser *oauth.MultiAccountUser 1271 + BaseParams 1252 1272 RepoInfo repoinfo.RepoInfo 1253 1273 Active string 1254 1274 Issue *models.Issue ··· 1267 1287 } 1268 1288 1269 1289 type EditIssueParams struct { 1270 - LoggedInUser *oauth.MultiAccountUser 1290 + BaseParams 1271 1291 RepoInfo repoinfo.RepoInfo 1272 1292 Issue *models.Issue 1273 1293 Action string ··· 1292 1312 } 1293 1313 1294 1314 type RepoNewIssueParams struct { 1295 - LoggedInUser *oauth.MultiAccountUser 1315 + BaseParams 1296 1316 RepoInfo repoinfo.RepoInfo 1297 1317 Issue *models.Issue // existing issue if any -- passed when editing 1298 1318 Active string ··· 1311 1331 } 1312 1332 1313 1333 type RepoNewPullParams struct { 1314 - LoggedInUser *oauth.MultiAccountUser 1334 + BaseParams 1315 1335 RepoInfo repoinfo.RepoInfo 1316 1336 Branches []types.Branch 1317 1337 SourceBranches []types.Branch ··· 1353 1373 } 1354 1374 1355 1375 type RepoPullsParams struct { 1356 - LoggedInUser *oauth.MultiAccountUser 1376 + BaseParams 1357 1377 RepoInfo repoinfo.RepoInfo 1358 1378 Pulls []*models.Pull 1359 1379 Active string ··· 1392 1412 } 1393 1413 1394 1414 type RepoSinglePullParams struct { 1395 - LoggedInUser *oauth.MultiAccountUser 1415 + BaseParams 1396 1416 RepoInfo repoinfo.RepoInfo 1397 1417 Active string 1398 1418 Pull *models.Pull ··· 1421 1441 } 1422 1442 1423 1443 type PullResubmitParams struct { 1424 - LoggedInUser *oauth.MultiAccountUser 1444 + BaseParams 1425 1445 RepoInfo repoinfo.RepoInfo 1426 1446 Pull *models.Pull 1427 1447 SubmissionId int ··· 1432 1452 } 1433 1453 1434 1454 type PullActionsParams struct { 1435 - LoggedInUser *oauth.MultiAccountUser 1455 + BaseParams 1436 1456 RepoInfo repoinfo.RepoInfo 1437 1457 Pull *models.Pull 1438 1458 RoundNumber int ··· 1447 1467 } 1448 1468 1449 1469 type PullNewCommentParams struct { 1450 - LoggedInUser *oauth.MultiAccountUser 1470 + BaseParams 1451 1471 RepoInfo repoinfo.RepoInfo 1452 1472 Pull *models.Pull 1453 1473 RoundNumber int ··· 1458 1478 } 1459 1479 1460 1480 type RepoCompareParams struct { 1461 - LoggedInUser *oauth.MultiAccountUser 1481 + BaseParams 1462 1482 RepoInfo repoinfo.RepoInfo 1463 1483 Forks []models.Repo 1464 1484 Branches []types.Branch ··· 1477 1497 } 1478 1498 1479 1499 type RepoCompareNewParams struct { 1480 - LoggedInUser *oauth.MultiAccountUser 1500 + BaseParams 1481 1501 RepoInfo repoinfo.RepoInfo 1482 1502 Forks []models.Repo 1483 1503 Branches []types.Branch ··· 1494 1514 } 1495 1515 1496 1516 type RepoCompareAllowPullParams struct { 1497 - LoggedInUser *oauth.MultiAccountUser 1517 + BaseParams 1498 1518 RepoInfo repoinfo.RepoInfo 1499 1519 Base string 1500 1520 Head string ··· 1514 1534 } 1515 1535 1516 1536 type LabelPanelParams struct { 1517 - LoggedInUser *oauth.MultiAccountUser 1537 + BaseParams 1518 1538 RepoInfo repoinfo.RepoInfo 1519 1539 Defs map[string]*models.LabelDefinition 1520 1540 Subject string ··· 1526 1546 } 1527 1547 1528 1548 type EditLabelPanelParams struct { 1529 - LoggedInUser *oauth.MultiAccountUser 1549 + BaseParams 1530 1550 RepoInfo repoinfo.RepoInfo 1531 1551 Defs map[string]*models.LabelDefinition 1532 1552 Subject string ··· 1539 1559 } 1540 1560 1541 1561 type RepoStarsParams struct { 1542 - LoggedInUser *oauth.MultiAccountUser 1562 + BaseParams 1543 1563 RepoInfo repoinfo.RepoInfo 1544 1564 Active string 1545 1565 Starrers []models.Star ··· 1553 1573 } 1554 1574 1555 1575 type RepoForksParams struct { 1556 - LoggedInUser *oauth.MultiAccountUser 1576 + BaseParams 1557 1577 RepoInfo repoinfo.RepoInfo 1558 1578 Active string 1559 1579 Forks []models.Repo ··· 1567 1587 } 1568 1588 1569 1589 type PipelinesParams struct { 1570 - LoggedInUser *oauth.MultiAccountUser 1590 + BaseParams 1571 1591 RepoInfo repoinfo.RepoInfo 1572 1592 Pipelines []models.Pipeline 1573 1593 Active string ··· 1621 1641 } 1622 1642 1623 1643 type WorkflowParams struct { 1624 - LoggedInUser *oauth.MultiAccountUser 1644 + BaseParams 1625 1645 RepoInfo repoinfo.RepoInfo 1626 1646 Pipeline models.Pipeline 1627 1647 Workflow string ··· 1635 1655 } 1636 1656 1637 1657 type PutStringParams struct { 1638 - LoggedInUser *oauth.MultiAccountUser 1658 + BaseParams 1639 1659 Action string 1640 1660 1641 1661 // this is supplied in the case of editing an existing string ··· 1647 1667 } 1648 1668 1649 1669 type StringsDashboardParams struct { 1650 - LoggedInUser *oauth.MultiAccountUser 1670 + BaseParams 1651 1671 Card ProfileCard 1652 1672 Strings []models.String 1653 1673 } ··· 1657 1677 } 1658 1678 1659 1679 type StringTimelineParams struct { 1660 - LoggedInUser *oauth.MultiAccountUser 1680 + BaseParams 1661 1681 Strings []models.String 1662 1682 } 1663 1683 ··· 1666 1686 } 1667 1687 1668 1688 type SingleStringParams struct { 1669 - LoggedInUser *oauth.MultiAccountUser 1689 + BaseParams 1670 1690 ShowRendered bool 1671 1691 RenderToggle bool 1672 1692 RenderedContents template.HTML ··· 1687 1707 } 1688 1708 1689 1709 type SearchReposParams struct { 1690 - LoggedInUser *oauth.MultiAccountUser 1710 + BaseParams 1691 1711 Repos []models.Repo 1692 1712 Page pagination.Page 1693 1713 ResultCount int ··· 1753 1773 } 1754 1774 1755 1775 type ReplyCommentFragmentParams struct { 1756 - LoggedInUser *oauth.MultiAccountUser 1776 + BaseParams 1757 1777 } 1758 1778 1759 1779 func (p *Pages) ReplyCommentFragment(w io.Writer, params ReplyCommentFragmentParams) error { ··· 1761 1781 } 1762 1782 1763 1783 type ReplyPlaceholderFragmentParams struct { 1764 - LoggedInUser *oauth.MultiAccountUser 1784 + BaseParams 1765 1785 } 1766 1786 1767 1787 func (p *Pages) ReplyPlaceholderFragment(w io.Writer, params ReplyPlaceholderFragmentParams) error {
+2 -2
appview/pipelines/pipelines.go
··· 119 119 } 120 120 121 121 p.pages.Pipelines(w, pages.PipelinesParams{ 122 - LoggedInUser: user, 122 + BaseParams: pages.BaseParamsFromContext(r.Context()), 123 123 RepoInfo: p.repoResolver.GetRepoInfo(r, user), 124 124 Pipelines: ps, 125 125 FilterKind: filterKind, ··· 168 168 singlePipeline := ps[0] 169 169 170 170 p.pages.Workflow(w, pages.WorkflowParams{ 171 - LoggedInUser: user, 171 + BaseParams: pages.BaseParamsFromContext(r.Context()), 172 172 RepoInfo: p.repoResolver.GetRepoInfo(r, user), 173 173 Pipeline: singlePipeline, 174 174 Workflow: workflow,
+1 -1
appview/pulls/comment.go
··· 37 37 switch r.Method { 38 38 case http.MethodGet: 39 39 s.pages.PullNewCommentFragment(w, pages.PullNewCommentParams{ 40 - LoggedInUser: user, 40 + BaseParams: pages.BaseParamsFromContext(r.Context()), 41 41 RepoInfo: s.repoResolver.GetRepoInfo(r, user), 42 42 Pull: pull, 43 43 RoundNumber: roundNumber,
+1 -1
appview/pulls/compose.go
··· 306 306 } 307 307 308 308 return pages.RepoNewPullParams{ 309 - LoggedInUser: user, 309 + BaseParams: pages.BaseParamsFromContext(r.Context()), 310 310 RepoInfo: repoInfo, 311 311 Branches: branches, 312 312 SourceBranches: sourceBranchList,
+1 -1
appview/pulls/list.go
··· 310 310 } 311 311 312 312 err = s.pages.RepoPulls(w, pages.RepoPullsParams{ 313 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 313 + BaseParams: pages.BaseParamsFromContext(r.Context()), 314 314 RepoInfo: repoInfo, 315 315 Pulls: pulls, 316 316 LabelDefs: defs,
+2 -2
appview/pulls/single.go
··· 66 66 } 67 67 68 68 s.pages.PullActionsFragment(w, pages.PullActionsParams{ 69 - LoggedInUser: user, 69 + BaseParams: pages.BaseParamsFromContext(r.Context()), 70 70 RepoInfo: s.repoResolver.GetRepoInfo(r, user), 71 71 Pull: pull, 72 72 RoundNumber: roundNumber, ··· 251 251 } 252 252 253 253 err = s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ 254 - LoggedInUser: user, 254 + BaseParams: pages.BaseParamsFromContext(r.Context()), 255 255 RepoInfo: s.repoResolver.GetRepoInfo(r, user), 256 256 Pull: pull, 257 257 Stack: stack,
+1 -1
appview/repo/artifact.go
··· 127 127 } 128 128 129 129 rp.pages.RepoArtifactFragment(w, pages.RepoArtifactParams{ 130 - LoggedInUser: user, 130 + BaseParams: pages.BaseParamsFromContext(r.Context()), 131 131 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 132 132 Artifact: artifact, 133 133 })
+1 -1
appview/repo/blob.go
··· 203 203 204 204 user := rp.oauth.GetMultiAccountUser(r) 205 205 rp.pages.RepoBlob(w, pages.RepoBlobParams{ 206 - LoggedInUser: user, 206 + BaseParams: pages.BaseParamsFromContext(r.Context()), 207 207 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 208 208 BreadCrumbs: breadcrumbs, 209 209 BlobView: blobView,
+1 -1
appview/repo/branches.go
··· 38 38 sortBranches(result.Branches) 39 39 user := rp.oauth.GetMultiAccountUser(r) 40 40 rp.pages.RepoBranches(w, pages.RepoBranchesParams{ 41 - LoggedInUser: user, 41 + BaseParams: pages.BaseParamsFromContext(r.Context()), 42 42 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 43 43 RepoBranchesResponse: result, 44 44 })
+2 -2
appview/repo/compare.go
··· 84 84 } 85 85 86 86 rp.pages.RepoCompareNew(w, pages.RepoCompareNewParams{ 87 - LoggedInUser: user, 87 + BaseParams: pages.BaseParamsFromContext(r.Context()), 88 88 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 89 89 Branches: branches, 90 90 Tags: tags.Tags, ··· 201 201 } 202 202 203 203 rp.pages.RepoCompare(w, pages.RepoCompareParams{ 204 - LoggedInUser: user, 204 + BaseParams: pages.BaseParamsFromContext(r.Context()), 205 205 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 206 206 Branches: branches.Branches, 207 207 Tags: tags.Tags,
+2 -2
appview/repo/index.go
··· 58 58 if err != nil { 59 59 l.Error("failed to build index response", "err", err) 60 60 rp.pages.RepoIndexPage(w, pages.RepoIndexParams{ 61 - LoggedInUser: user, 61 + BaseParams: pages.BaseParamsFromContext(r.Context()), 62 62 KnotUnreachable: true, 63 63 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 64 64 }) ··· 171 171 } 172 172 173 173 rp.pages.RepoIndexPage(w, pages.RepoIndexParams{ 174 - LoggedInUser: user, 174 + BaseParams: pages.BaseParamsFromContext(r.Context()), 175 175 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 176 176 TagMap: tagMap, 177 177 RepoIndexResponse: *result,
+2 -2
appview/repo/log.go
··· 185 185 } 186 186 187 187 rp.pages.RepoLog(w, pages.RepoLogParams{ 188 - LoggedInUser: user, 188 + BaseParams: pages.BaseParamsFromContext(r.Context()), 189 189 TagMap: tagMap, 190 190 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 191 191 RepoLogResponse: xrpcResp, ··· 261 261 } 262 262 263 263 rp.pages.RepoCommit(w, pages.RepoCommitParams{ 264 - LoggedInUser: user, 264 + BaseParams: pages.BaseParamsFromContext(r.Context()), 265 265 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 266 266 RepoCommitResponse: result, 267 267 EmailToDid: emailToDidMap,
+5 -5
appview/repo/repo.go
··· 664 664 665 665 user := rp.oauth.GetMultiAccountUser(r) 666 666 rp.pages.LabelPanel(w, pages.LabelPanelParams{ 667 - LoggedInUser: user, 667 + BaseParams: pages.BaseParamsFromContext(r.Context()), 668 668 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 669 669 Defs: defs, 670 670 Subject: subject.String(), ··· 712 712 713 713 user := rp.oauth.GetMultiAccountUser(r) 714 714 rp.pages.EditLabelPanel(w, pages.EditLabelPanelParams{ 715 - LoggedInUser: user, 715 + BaseParams: pages.BaseParamsFromContext(r.Context()), 716 716 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 717 717 Defs: defs, 718 718 Subject: subject.String(), ··· 1425 1425 knots := rp.acl.KnotsForUser(r.Context(), user.Did) 1426 1426 1427 1427 rp.pages.ForkRepo(w, pages.ForkRepoParams{ 1428 - LoggedInUser: user, 1428 + BaseParams: pages.BaseParamsFromContext(r.Context()), 1429 1429 Knots: knots, 1430 1430 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 1431 1431 }) ··· 1697 1697 } 1698 1698 1699 1699 rp.pages.RepoStars(w, pages.RepoStarsParams{ 1700 - LoggedInUser: user, 1700 + BaseParams: pages.BaseParamsFromContext(r.Context()), 1701 1701 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 1702 1702 Starrers: starrers, 1703 1703 Page: page, ··· 1733 1733 } 1734 1734 1735 1735 err = rp.pages.RepoForks(w, pages.RepoForksParams{ 1736 - LoggedInUser: user, 1736 + BaseParams: pages.BaseParamsFromContext(r.Context()), 1737 1737 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 1738 1738 Forks: forks, 1739 1739 Page: page,
+4 -4
appview/repo/settings.go
··· 241 241 } 242 242 243 243 rp.pages.RepoSiteSettings(w, pages.RepoSiteSettingsParams{ 244 - LoggedInUser: user, 244 + BaseParams: pages.BaseParamsFromContext(r.Context()), 245 245 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 246 246 Branches: result.Branches, 247 247 SiteConfig: siteConfig, ··· 436 436 } 437 437 438 438 rp.pages.RepoGeneralSettings(w, pages.RepoGeneralSettingsParams{ 439 - LoggedInUser: user, 439 + BaseParams: pages.BaseParamsFromContext(r.Context()), 440 440 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 441 441 Branches: result.Branches, 442 442 Labels: labels, ··· 459 459 collaborators := rp.acl.Collaborators(r.Context(), f) 460 460 461 461 rp.pages.RepoAccessSettings(w, pages.RepoAccessSettingsParams{ 462 - LoggedInUser: user, 462 + BaseParams: pages.BaseParamsFromContext(r.Context()), 463 463 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 464 464 Collaborators: collaborators, 465 465 CanRemoveCollaborator: knotcompat.KnotHasCapability(r.Context(), f.Knot, rp.config.Core.Dev, consts.CapKnotACL), ··· 519 519 } 520 520 521 521 rp.pages.RepoPipelineSettings(w, pages.RepoPipelineSettingsParams{ 522 - LoggedInUser: user, 522 + BaseParams: pages.BaseParamsFromContext(r.Context()), 523 523 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 524 524 Spindles: spindles, 525 525 CurrentSpindle: f.Spindle,
+2 -2
appview/repo/tags.go
··· 67 67 user := rp.oauth.GetMultiAccountUser(r) 68 68 69 69 rp.pages.RepoTags(w, pages.RepoTagsParams{ 70 - LoggedInUser: user, 70 + BaseParams: pages.BaseParamsFromContext(r.Context()), 71 71 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 72 72 RepoTagsResponse: result, 73 73 ArtifactMap: artifactMap, ··· 142 142 143 143 user := rp.oauth.GetMultiAccountUser(r) 144 144 rp.pages.RepoTag(w, pages.RepoTagParams{ 145 - LoggedInUser: user, 145 + BaseParams: pages.BaseParamsFromContext(r.Context()), 146 146 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 147 147 RepoTagResponse: result, 148 148 ArtifactMap: artifactMap,
+1 -1
appview/repo/tree.go
··· 128 128 129 129 user := rp.oauth.GetMultiAccountUser(r) 130 130 rp.pages.RepoTree(w, pages.RepoTreeParams{ 131 - LoggedInUser: user, 131 + BaseParams: pages.BaseParamsFromContext(r.Context()), 132 132 BreadCrumbs: breadcrumbs, 133 133 Path: treePath, 134 134 RepoInfo: rp.repoResolver.GetRepoInfo(r, user),
+2 -2
appview/repo/webhooks.go
··· 45 45 } 46 46 47 47 rp.pages.RepoWebhooksSettings(w, pages.RepoWebhooksSettingsParams{ 48 - LoggedInUser: user, 48 + BaseParams: pages.BaseParamsFromContext(r.Context()), 49 49 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 50 50 Webhooks: webhooks, 51 51 WebhookDeliveries: deliveriesMap, ··· 365 365 user := rp.oauth.GetMultiAccountUser(r) 366 366 367 367 rp.pages.WebhookDeliveriesList(w, pages.WebhookDeliveriesListParams{ 368 - LoggedInUser: user, 368 + BaseParams: pages.BaseParamsFromContext(r.Context()), 369 369 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 370 370 Webhook: webhook, 371 371 Deliveries: deliveries,
+5 -6
appview/settings/settings.go
··· 125 125 isTnglHandle, _ := s.isTnglHandle(r.Context(), syntax.DID(user.Did)) 126 126 127 127 s.Pages.UserSiteSettings(w, pages.UserSiteSettingsParams{ 128 - LoggedInUser: user, 128 + BaseParams: pages.BaseParamsFromContext(r.Context()), 129 129 Claim: claim, 130 130 SitesDomain: s.Config.Sites.Domain, 131 131 IsTnglHandle: isTnglHandle, ··· 270 270 isDeactivated := s.isAccountDeactivated(r.Context(), syntax.DID(user.Did)) 271 271 272 272 s.Pages.UserProfileSettings(w, pages.UserProfileSettingsParams{ 273 - LoggedInUser: user, 273 + BaseParams: pages.BaseParamsFromContext(r.Context()), 274 274 PunchcardPreference: punchcardPreferences, 275 275 IsTnglSh: isTnglSh, 276 276 IsDeactivated: isDeactivated, ··· 279 279 } 280 280 281 281 func (s *Settings) notificationsSettings(w http.ResponseWriter, r *http.Request) { 282 - user := s.OAuth.GetMultiAccountUser(r) 283 282 did := s.OAuth.GetDid(r) 284 283 285 284 prefs, err := db.GetNotificationPreference(s.Db, did) ··· 290 289 } 291 290 292 291 s.Pages.UserNotificationSettings(w, pages.UserNotificationSettingsParams{ 293 - LoggedInUser: user, 292 + BaseParams: pages.BaseParamsFromContext(r.Context()), 294 293 Preferences: prefs, 295 294 }) 296 295 } ··· 330 329 } 331 330 332 331 s.Pages.UserKeysSettings(w, pages.UserKeysSettingsParams{ 333 - LoggedInUser: user, 332 + BaseParams: pages.BaseParamsFromContext(r.Context()), 334 333 PubKeys: pubKeys, 335 334 }) 336 335 } ··· 343 342 } 344 343 345 344 s.Pages.UserEmailsSettings(w, pages.UserEmailsSettingsParams{ 346 - LoggedInUser: user, 345 + BaseParams: pages.BaseParamsFromContext(r.Context()), 347 346 Emails: emails, 348 347 }) 349 348 }
+2 -2
appview/spindles/spindles.go
··· 69 69 } 70 70 71 71 s.Pages.Spindles(w, pages.SpindlesParams{ 72 - LoggedInUser: user, 72 + BaseParams: pages.BaseParamsFromContext(r.Context()), 73 73 Spindles: all, 74 74 Tab: "spindles", 75 75 }) ··· 126 126 } 127 127 128 128 s.Pages.SpindleDashboard(w, pages.SpindleDashboardParams{ 129 - LoggedInUser: user, 129 + BaseParams: pages.BaseParamsFromContext(r.Context()), 130 130 Spindle: spindle, 131 131 Members: members, 132 132 Repos: repoMap,
+2 -2
appview/state/comment.go
··· 77 77 78 78 func (s *State) NewReplyCommentFragment(w http.ResponseWriter, r *http.Request) { 79 79 s.pages.ReplyCommentFragment(w, pages.ReplyCommentFragmentParams{ 80 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 80 + BaseParams: pages.BaseParamsFromContext(r.Context()), 81 81 }) 82 82 } 83 83 84 84 func (s *State) ReplyPlaceholderFragment(w http.ResponseWriter, r *http.Request) { 85 85 s.pages.ReplyPlaceholderFragment(w, pages.ReplyPlaceholderFragmentParams{ 86 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 86 + BaseParams: pages.BaseParamsFromContext(r.Context()), 87 87 }) 88 88 } 89 89
+2 -3
appview/state/gfi.go
··· 14 14 15 15 func (s *State) GoodFirstIssues(w http.ResponseWriter, r *http.Request) { 16 16 l := s.logger.With("handler", "GoodFirstIssues") 17 - user := s.oauth.GetMultiAccountUser(r) 18 17 19 18 page := pagination.FromContext(r.Context()) 20 19 ··· 36 35 37 36 if len(repoLabels) == 0 { 38 37 s.pages.GoodFirstIssues(w, pages.GoodFirstIssuesParams{ 39 - LoggedInUser: user, 38 + BaseParams: pages.BaseParamsFromContext(r.Context()), 40 39 RepoGroups: []*models.RepoGroup{}, 41 40 LabelDefs: make(map[string]*models.LabelDefinition), 42 41 Page: page, ··· 145 144 } 146 145 147 146 s.pages.GoodFirstIssues(w, pages.GoodFirstIssuesParams{ 148 - LoggedInUser: user, 147 + BaseParams: pages.BaseParamsFromContext(r.Context()), 149 148 RepoGroups: paginatedGroups, 150 149 LabelDefs: labelDefsMap, 151 150 Page: page,
+11 -11
appview/state/profile.go
··· 187 187 } 188 188 189 189 err = s.pages.ProfileOverview(w, pages.ProfileOverviewParams{ 190 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 190 + BaseParams: pages.BaseParamsFromContext(r.Context()), 191 191 Card: profile, 192 192 Repos: pinnedRepos, 193 193 CollaboratingRepos: pinnedCollaboratingRepos, ··· 336 336 } 337 337 338 338 err = s.pages.ProfileRepos(w, pages.ProfileReposParams{ 339 - LoggedInUser: loggedInUser, 339 + BaseParams: pages.BaseParamsFromContext(r.Context()), 340 340 Repos: repos, 341 341 StarStatuses: starStatuses, 342 342 Card: profile, ··· 375 375 } 376 376 377 377 err = s.pages.ProfileStarred(w, pages.ProfileStarredParams{ 378 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 378 + BaseParams: pages.BaseParamsFromContext(r.Context()), 379 379 Repos: repos, 380 380 Total: int(profile.Stats.StarredCount), 381 381 Card: profile, ··· 405 405 } 406 406 407 407 err = s.pages.ProfileStrings(w, pages.ProfileStringsParams{ 408 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 408 + BaseParams: pages.BaseParamsFromContext(r.Context()), 409 409 Strings: strings, 410 410 Card: profile, 411 411 }) ··· 502 502 } 503 503 504 504 err = s.pages.ProfileVouches(w, pages.ProfileVouchesParams{ 505 - LoggedInUser: loggedInUser, 505 + BaseParams: pages.BaseParamsFromContext(r.Context()), 506 506 Vouches: vouches, 507 507 Suggestions: suggestions, 508 508 Card: profile, ··· 596 596 profile.Did = did 597 597 } 598 598 followCards[i] = pages.FollowCard{ 599 - LoggedInUser: loggedInUser, 599 + BaseParams: pages.BaseParamsFromContext(r.Context()), 600 600 UserDid: did, 601 601 FollowStatus: followStatus, 602 602 FollowersCount: followStats.Followers, ··· 618 618 } 619 619 620 620 s.pages.ProfileFollowers(w, pages.ProfileFollowersParams{ 621 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 621 + BaseParams: pages.BaseParamsFromContext(r.Context()), 622 622 Followers: followPage.Follows, 623 623 Card: followPage.Card, 624 624 }) ··· 632 632 } 633 633 634 634 s.pages.ProfileFollowing(w, pages.ProfileFollowingParams{ 635 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 635 + BaseParams: pages.BaseParamsFromContext(r.Context()), 636 636 Following: followPage.Follows, 637 637 Card: followPage.Card, 638 638 }) ··· 1008 1008 } 1009 1009 1010 1010 s.pages.ProfilePopoverFragment(w, pages.ProfilePopoverParams{ 1011 - LoggedInUser: loggedInUser, 1011 + BaseParams: pages.BaseParamsFromContext(r.Context()), 1012 1012 UserDid: did, 1013 1013 Profile: profile, 1014 1014 FollowStatus: followStatus, ··· 1039 1039 } 1040 1040 1041 1041 s.pages.EditBioFragment(w, pages.EditBioParams{ 1042 - LoggedInUser: user, 1042 + BaseParams: pages.BaseParamsFromContext(r.Context()), 1043 1043 Profile: profile, 1044 1044 AlsoKnownAs: alsoKnownAs, 1045 1045 }) ··· 1083 1083 } 1084 1084 1085 1085 s.pages.EditPinsFragment(w, pages.EditPinsParams{ 1086 - LoggedInUser: user, 1086 + BaseParams: pages.BaseParamsFromContext(r.Context()), 1087 1087 Profile: profile, 1088 1088 AllRepos: allRepos, 1089 1089 })
+9
appview/state/router.go
··· 9 9 10 10 "github.com/go-chi/chi/v5" 11 11 "tangled.org/core/appview/db" 12 + "tangled.org/core/appview/focus" 12 13 "tangled.org/core/appview/issues" 13 14 "tangled.org/core/appview/knotacl" 14 15 "tangled.org/core/appview/knots" ··· 127 128 128 129 func (s *State) UserRouter(mw *middleware.Middleware) http.Handler { 129 130 r := chi.NewRouter() 131 + r.Use(mw.InjectBaseParams) 130 132 131 133 r.With(mw.ResolveIdent()).Route("/{user}", func(r chi.Router) { 132 134 r.Get("/", s.Profile) ··· 162 164 163 165 func (s *State) StandardRouter(mw *middleware.Middleware) http.Handler { 164 166 r := chi.NewRouter() 167 + r.Use(mw.InjectBaseParams) 165 168 166 169 r.Handle("/static/*", s.pages.Static()) 167 170 ··· 248 251 r.Mount("/settings/spindles", s.SpindlesRouter()) 249 252 250 253 r.Mount("/notifications", s.NotificationsRouter(mw)) 254 + r.Mount("/focus", s.FocusRouter(mw)) 251 255 252 256 r.Mount("/signup", s.SignupRouter()) 253 257 r.Mount("/", s.oauth.Router()) ··· 428 432 func (s *State) NotificationsRouter(mw *middleware.Middleware) http.Handler { 429 433 notifs := notifications.New(s.db, s.oauth, s.pages, log.SubLogger(s.logger, "notifications")) 430 434 return notifs.Router(mw) 435 + } 436 + 437 + func (s *State) FocusRouter(mw *middleware.Middleware) http.Handler { 438 + f := focus.New(s.db, s.oauth, s.idResolver, s.pages, log.SubLogger(s.logger, "focus")) 439 + return f.Router(mw) 431 440 } 432 441 433 442 func (s *State) SignupRouter() http.Handler {
+1 -1
appview/state/search.go
··· 142 142 } 143 143 144 144 err = s.pages.SearchRepos(w, pages.SearchReposParams{ 145 - LoggedInUser: s.oauth.GetMultiAccountUser(r), 145 + BaseParams: pages.BaseParamsFromContext(r.Context()), 146 146 Repos: repos, 147 147 Page: page, 148 148 FilterQuery: query.String(),
+4 -7
appview/state/state.go
··· 297 297 } 298 298 299 299 func (s *State) TermsOfService(w http.ResponseWriter, r *http.Request) { 300 - user := s.oauth.GetMultiAccountUser(r) 301 300 s.pages.TermsOfService(w, pages.TermsOfServiceParams{ 302 - LoggedInUser: user, 301 + BaseParams: pages.BaseParamsFromContext(r.Context()), 303 302 }) 304 303 } 305 304 306 305 func (s *State) PrivacyPolicy(w http.ResponseWriter, r *http.Request) { 307 - user := s.oauth.GetMultiAccountUser(r) 308 306 s.pages.PrivacyPolicy(w, pages.PrivacyPolicyParams{ 309 - LoggedInUser: user, 307 + BaseParams: pages.BaseParamsFromContext(r.Context()), 310 308 }) 311 309 } 312 310 313 311 func (s *State) Brand(w http.ResponseWriter, r *http.Request) { 314 - user := s.oauth.GetMultiAccountUser(r) 315 312 s.pages.Brand(w, pages.BrandParams{ 316 - LoggedInUser: user, 313 + BaseParams: pages.BaseParamsFromContext(r.Context()), 317 314 }) 318 315 } 319 316 ··· 458 455 knots := s.aclService.KnotsForUser(r.Context(), user.Did) 459 456 460 457 s.pages.NewRepo(w, pages.NewRepoParams{ 461 - LoggedInUser: user, 458 + BaseParams: pages.BaseParamsFromContext(r.Context()), 462 459 Knots: knots, 463 460 }) 464 461
+4 -4
appview/strings/strings.go
··· 79 79 } 80 80 81 81 s.Pages.StringsTimeline(w, pages.StringTimelineParams{ 82 - LoggedInUser: s.OAuth.GetMultiAccountUser(r), 82 + BaseParams: pages.BaseParamsFromContext(r.Context()), 83 83 Strings: strings, 84 84 }) 85 85 } ··· 192 192 } 193 193 194 194 err = s.Pages.SingleString(w, pages.SingleStringParams{ 195 - LoggedInUser: user, 195 + BaseParams: pages.BaseParamsFromContext(r.Context()), 196 196 RenderToggle: renderToggle, 197 197 ShowRendered: showRendered, 198 198 String: &string, ··· 263 263 case http.MethodGet: 264 264 // return the form with prefilled fields 265 265 s.Pages.PutString(w, pages.PutStringParams{ 266 - LoggedInUser: s.OAuth.GetMultiAccountUser(r), 266 + BaseParams: pages.BaseParamsFromContext(r.Context()), 267 267 Action: "edit", 268 268 String: first, 269 269 }) ··· 348 348 switch r.Method { 349 349 case http.MethodGet: 350 350 s.Pages.PutString(w, pages.PutStringParams{ 351 - LoggedInUser: s.OAuth.GetMultiAccountUser(r), 351 + BaseParams: pages.BaseParamsFromContext(r.Context()), 352 352 Action: "new", 353 353 }) 354 354 case http.MethodPost:
+1 -1
appview/timeline/home.go
··· 26 26 } 27 27 28 28 t.pages.Home(w, pages.TimelineParams{ 29 - LoggedInUser: user, 29 + BaseParams: pages.BaseParamsFromContext(r.Context()), 30 30 Timeline: timeline, 31 31 BlueskyPosts: blueskyPosts, 32 32 RecentBlogPosts: t.recentPosts,
+8 -1
appview/timeline/timeline.go
··· 82 82 } 83 83 } 84 84 85 + var canFocus bool 86 + if user != nil { 87 + focusCount, _ := db.CountFocusNotifs(t.db, user.Did) 88 + canFocus = focusCount > 1 89 + } 90 + 85 91 err = t.pages.Timeline(w, pages.TimelineParams{ 86 - LoggedInUser: user, 92 + BaseParams: pages.BaseParamsFromContext(r.Context()), 87 93 Timeline: timeline, 88 94 Repos: repos, 89 95 GfiLabel: gfiLabel, ··· 93 99 FollowingOnly: followingOnly, 94 100 RecentBlogPosts: t.recentPosts, 95 101 ShowNewsletter: t.showNewsletter(user), 102 + CanFocus: canFocus, 96 103 }) 97 104 if err != nil { 98 105 t.logger.Error("failed to render timeline", "err", err)