1package daemon23import (4 "context"5 "net/url"6 "strings"7)89// personSegment is how a person is written in a page path: the member name10// when the key has one, else the hex pubkey.11func (t *Tenant) personSegment(ctx context.Context, pubkey string) string {12 if t.community == nil {13 return pubkey14 }15 name, err := t.community.MemberName(ctx, pubkey)16 if err != nil || name == "" {17 return pubkey18 }19 return url.PathEscape(name)20}2122// repoPageURL is the repository home page under the public URL.23func (t *Tenant) repoPageURL(ctx context.Context, owner, identifier string) string {24 return strings.TrimRight(t.publicURL, "/") + "/repos/" + t.personSegment(ctx, owner) + "/" + url.PathEscape(identifier)25}2627// repoItemURL is the page of an issue ("issues") or pull request ("prs")28// in the repository.29func (t *Tenant) repoItemURL(ctx context.Context, owner, identifier, section, id string) string {30 return t.repoPageURL(ctx, owner, identifier) + "/" + section + "/" + id31}3233// wikiProposalURL is the merge request compare page of a wiki page.34func (t *Tenant) wikiProposalURL(d, id string) string {35 return strings.TrimRight(t.publicURL, "/") + "/wiki/" + url.PathEscape(d) + "/proposals/" + id36}