From dd797c8145d17cca04454cc59d522e521adf332a Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Fri, 13 Oct 2023 16:45:12 -0400 Subject: [PATCH] Add missing methods for showing fediverse followers Fixes #791 --- activitypub.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/activitypub.go b/activitypub.go index 02fb9e7..2905124 100644 --- a/activitypub.go +++ b/activitypub.go @@ -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 {