diff --git a/appview/config/config.go b/appview/config/config.go index d8a533e8..32a702b0 100644 --- a/appview/config/config.go +++ b/appview/config/config.go @@ -24,6 +24,8 @@ type CoreConfig struct { // uhhhh this is because knot1 is under icy's did TmpAltAppPassword string `env:"ALT_APP_PASSWORD"` + + StaffDids []string `env:"STAFF_DIDS"` } func (c *CoreConfig) UseTLS() bool { diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index 5340ca5a..fa612b2a 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -509,6 +509,9 @@ func (p *Pages) funcMap() template.FuncMap { // cast to DID return syntax.DID(s) }, + "isStaff": func(did string) bool { + return p.staffDids[did] + }, } } diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 17084261..bd728213 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -44,6 +44,7 @@ type Pages struct { avatar config.AvatarConfig pdsCfg config.PdsConfig + staffDids map[string]bool resolver *idresolver.Resolver db *db.DB rdb *cache.Cache @@ -65,12 +66,18 @@ func NewPages(config *config.Config, res *idresolver.Resolver, database *db.DB, Files: Files, } + staffDids := make(map[string]bool, len(config.Core.StaffDids)) + for _, did := range config.Core.StaffDids { + staffDids[did] = true + } + p := &Pages{ mu: sync.RWMutex{}, cache: NewTmplCache[string, *template.Template](), dev: config.Core.Dev, avatar: config.Avatar, pdsCfg: config.Pds, + staffDids: staffDids, rctx: rctx, resolver: res, db: database, diff --git a/appview/pages/templates/fragments/dolly/badge.html b/appview/pages/templates/fragments/dolly/badge.html new file mode 100644 index 00000000..fc369a29 --- /dev/null +++ b/appview/pages/templates/fragments/dolly/badge.html @@ -0,0 +1,9 @@ +{{ define "fragments/dolly/badge" }} + + {{ template "fragments/dolly/logo" (dict "Classes" "size-4/5") }} + +{{ end }} + diff --git a/appview/pages/templates/fragments/dolly/logo.html b/appview/pages/templates/fragments/dolly/logo.html index 5a7915d1..7c1adc07 100644 --- a/appview/pages/templates/fragments/dolly/logo.html +++ b/appview/pages/templates/fragments/dolly/logo.html @@ -1,96 +1,35 @@ {{ define "fragments/dolly/logo" }} + viewBox="0 0 73 70" + fill="none" + xmlns="http://www.w3.org/2000/svg"> - - - - - - - - - - - - - - - - - - - - + + + {{ end }} diff --git a/appview/pages/templates/notifications/fragments/item.html b/appview/pages/templates/notifications/fragments/item.html index eeadac0b..7160c633 100644 --- a/appview/pages/templates/notifications/fragments/item.html +++ b/appview/pages/templates/notifications/fragments/item.html @@ -31,7 +31,7 @@ {{ define "notificationHeader" }} {{ $actor := resolve .ActorDid }} - {{ $actor }} + {{ $actor }}{{ if isStaff .ActorDid }}{{ template "fragments/dolly/badge" . }}{{ end }} {{ if eq .Type "repo_starred" }} starred {{ resolve .Repo.Did }}/{{ .Repo.Name }} {{ else if eq .Type "issue_created" }} diff --git a/appview/pages/templates/repo/index.html b/appview/pages/templates/repo/index.html index fb166028..f9856086 100644 --- a/appview/pages/templates/repo/index.html +++ b/appview/pages/templates/repo/index.html @@ -278,7 +278,7 @@ class="no-underline hover:underline"> {{ if $author }}{{ resolve $author }}{{ else }}{{ $commit.Author.Name }}{{ end }} {{ if $coauthors }} +{{ length $coauthors }}{{ end }} - + {{ if $author }}{{ if isStaff $author }}{{ template "fragments/dolly/badge" . }}{{ end }}{{ end }} {{ end }} diff --git a/appview/pages/templates/repo/issues/fragments/issueCommentHeader.html b/appview/pages/templates/repo/issues/fragments/issueCommentHeader.html index 538b0765..72ee5af1 100644 --- a/appview/pages/templates/repo/issues/fragments/issueCommentHeader.html +++ b/appview/pages/templates/repo/issues/fragments/issueCommentHeader.html @@ -2,6 +2,7 @@
{{ $handle := resolve .Comment.Did }} {{ $handle }} + {{ if isStaff .Comment.Did }}{{ template "fragments/dolly/badge" . }}{{ end }} {{ template "hats" $ }} {{ template "timestamp" . }} diff --git a/appview/pages/templates/repo/issues/fragments/issueListing.html b/appview/pages/templates/repo/issues/fragments/issueListing.html index f0b9af46..e53f6699 100644 --- a/appview/pages/templates/repo/issues/fragments/issueListing.html +++ b/appview/pages/templates/repo/issues/fragments/issueListing.html @@ -28,7 +28,7 @@ {{ template "user/fragments/picLink" (list .Did "size-6" (index $.VouchRelationships (did .Did))) }} - {{ resolve .Did }} + {{ resolve .Did }}{{ if isStaff .Did }}{{ template "fragments/dolly/badge" . }}{{ end }} diff --git a/appview/pages/templates/repo/issues/issue.html b/appview/pages/templates/repo/issues/issue.html index 21e13fb1..a946a22c 100644 --- a/appview/pages/templates/repo/issues/issue.html +++ b/appview/pages/templates/repo/issues/issue.html @@ -69,7 +69,7 @@ opened by {{ template "user/fragments/picLink" (list .Issue.Did "size-6" (index .VouchRelationships (did .Issue.Did))) }} - {{ resolve .Issue.Did }} + {{ resolve .Issue.Did }}{{ if isStaff .Issue.Did }}{{ template "fragments/dolly/badge" . }}{{ end }} {{ if .Issue.Edited }} edited {{ template "repo/fragments/time" .Issue.Edited }} diff --git a/appview/pages/templates/repo/pulls/fragments/pullHeader.html b/appview/pages/templates/repo/pulls/fragments/pullHeader.html index 0fac3d06..298ff45d 100644 --- a/appview/pages/templates/repo/pulls/fragments/pullHeader.html +++ b/appview/pages/templates/repo/pulls/fragments/pullHeader.html @@ -12,7 +12,7 @@ opened by {{ template "user/fragments/picLink" (list .Pull.OwnerDid "size-6" (index .VouchRelationships (did .Pull.OwnerDid))) }} - {{ resolve .Pull.OwnerDid }} + {{ resolve .Pull.OwnerDid }}{{ if isStaff .Pull.OwnerDid }}{{ template "fragments/dolly/badge" . }}{{ end }} {{ template "repo/fragments/time" .Pull.Created }} diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index 05b4247c..fb39db7b 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -334,7 +334,7 @@ {{ else }} text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 {{ end }} - " href="/{{ $handle }}">{{ $handle }} + " href="/{{ $handle }}">{{ $handle }}{{ if isStaff $root.Pull.OwnerDid }}{{ template "fragments/dolly/badge" $root }}{{ end }} submitted {{ $handle := resolve $comment.OwnerDid }} - {{ $handle }} + {{ $handle }}{{ if isStaff $comment.OwnerDid }}{{ template "fragments/dolly/badge" $root }}{{ end }} {{ template "repo/fragments/shortTime" $comment.Created }} diff --git a/appview/pages/templates/repo/pulls/pulls.html b/appview/pages/templates/repo/pulls/pulls.html index b8bdc2af..7e97a137 100644 --- a/appview/pages/templates/repo/pulls/pulls.html +++ b/appview/pages/templates/repo/pulls/pulls.html @@ -83,7 +83,7 @@ {{ template "repo/pulls/fragments/pullState" $topPR.State }} {{ template "user/fragments/picLink" (list $topPR.OwnerDid "size-6" (index $.VouchRelationships (did $topPR.OwnerDid))) }} - {{ resolve $topPR.OwnerDid }} + {{ resolve $topPR.OwnerDid }}{{ if isStaff $topPR.OwnerDid }}{{ template "fragments/dolly/badge" . }}{{ end }} diff --git a/appview/pages/templates/timeline/fragments/preview.html b/appview/pages/templates/timeline/fragments/preview.html index 1fb84bd6..3993bd54 100644 --- a/appview/pages/templates/timeline/fragments/preview.html +++ b/appview/pages/templates/timeline/fragments/preview.html @@ -149,7 +149,7 @@ {{ i "star" "size-4" }}
- {{ template "user/fragments/picHandleLink" $starrerHandle }} + {{ template "user/fragments/picHandleLink" .Did }} {{ if $group.IsCollapsed }} {{ template "timeline/fragments/othersBadge" $group }} @@ -192,7 +192,7 @@ {{ else }} followed {{ end }} - {{ template "user/fragments/picHandleLink" $subjectHandle }} + {{ template "user/fragments/picHandleLink" $follow.SubjectDid }}
{{ end }} diff --git a/appview/pages/templates/timeline/fragments/timeline.html b/appview/pages/templates/timeline/fragments/timeline.html index c89e9480..58b0e1f5 100644 --- a/appview/pages/templates/timeline/fragments/timeline.html +++ b/appview/pages/templates/timeline/fragments/timeline.html @@ -105,7 +105,7 @@ {{ else }} followed {{ end }} - {{ template "user/fragments/picHandleLink" $subjectHandle }} + {{ template "user/fragments/picHandleLink" $follow.SubjectDid }} {{ template "repo/fragments/time" $follow.FollowedAt }} {{ template "user/fragments/followCard" diff --git a/appview/pages/templates/user/fragments/picHandle.html b/appview/pages/templates/user/fragments/picHandle.html index c067fc80..bd0781f5 100644 --- a/appview/pages/templates/user/fragments/picHandle.html +++ b/appview/pages/templates/user/fragments/picHandle.html @@ -4,5 +4,5 @@ alt="" class="rounded-full h-6 w-6 border border-gray-300 dark:border-gray-700" /> -{{ . | resolve | truncateAt30 }} +{{ . | resolve | truncateAt30 }}{{ if isStaff . }}{{ template "fragments/dolly/badge" . }}{{ end }} {{ end }} diff --git a/appview/pages/templates/user/fragments/profileCard.html b/appview/pages/templates/user/fragments/profileCard.html index 135301b6..9ceaabac 100644 --- a/appview/pages/templates/user/fragments/profileCard.html +++ b/appview/pages/templates/user/fragments/profileCard.html @@ -22,11 +22,12 @@ {{ template "user/fragments/editAvatar" . }}
-
+

{{ $userIdent }}

+ {{ if isStaff .UserDid }}{{ template "fragments/dolly/badge" . }}{{ end }} {{ with .Profile }} {{ if .Pronouns }}

{{ .Pronouns }}

diff --git a/appview/pages/templates/user/fragments/profilePopover.html b/appview/pages/templates/user/fragments/profilePopover.html index 030a8eb1..b562fad3 100644 --- a/appview/pages/templates/user/fragments/profilePopover.html +++ b/appview/pages/templates/user/fragments/profilePopover.html @@ -2,7 +2,7 @@ {{ $handle := resolve .UserDid }}
-
+
-

- {{ $handle }} -

+
+

+ {{ $handle }} +

+ {{ if isStaff .UserDid }}{{ template "fragments/dolly/badge" . }}{{ end }} +
{{ with .Profile }} {{ if .Pronouns }}

{{ .Pronouns }}