diff options
Diffstat (limited to 'internal/gtsmodel/mention.go')
-rw-r--r-- | internal/gtsmodel/mention.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/internal/gtsmodel/mention.go b/internal/gtsmodel/mention.go index e00df8911..fd1d45622 100644 --- a/internal/gtsmodel/mention.go +++ b/internal/gtsmodel/mention.go @@ -18,7 +18,10 @@ package gtsmodel -import "time" +import ( + "context" + "time" +) // Mention refers to the 'tagging' or 'mention' of a user within a status. type Mention struct { @@ -57,3 +60,15 @@ type Mention struct { TargetAccountURL string `validate:"-" bun:"-"` // A pointer to the gtsmodel account of the mentioned account. } + +// ParseMentionFunc describes a function that takes a lowercase account name +// in the form "@test@whatever.example.org" for a remote account, or "@test" +// for a local account, and returns a fully populated mention for that account, +// with the given origin status ID and origin account ID. +// +// If the account is remote and not yet found in the database, then ParseMentionFunc +// will try to webfinger the remote account and put it in the database before returning. +// +// Mentions generated by this function are not put in the database, that's still up to +// the caller to do. +type ParseMentionFunc func(ctx context.Context, targetAccount string, originAccountID string, statusID string) (*Mention, error) |