mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 11:27:35 -06:00
[feature] Dereference remote mentions when the account is not already known (#442)
* remove mention util function from db * add ParseMentionFunc to gtsmodel * add parseMentionFunc to processor * refactor search to simplify it a bit * add parseMentionFunc to account * add parseMentionFunc to status * some renaming for clarity * test dereference of unknown mentioned account
This commit is contained in:
parent
983e696bd6
commit
37d310f981
16 changed files with 420 additions and 183 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue