Add missing methods for showing fediverse followers

Fixes #791
This commit is contained in:
Matt Baer 2023-10-13 16:45:12 -04:00
parent 4aad0338bf
commit dd797c8145
1 changed files with 14 additions and 0 deletions

View File

@ -65,6 +65,20 @@ type RemoteUser struct {
SharedInbox string
URL string
Handle string
Created time.Time
}
func (ru *RemoteUser) CreatedFriendly() string {
return ru.Created.Format("January 2, 2006")
}
func (ru *RemoteUser) EstimatedHandle() string {
if ru.Handle != "" {
return ru.Handle
}
username := filepath.Base(ru.ActorID)
host, _ := url.Parse(ru.ActorID)
return username + "@" + host.Host
}
func (ru *RemoteUser) AsPerson() *activitystreams.Person {