[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:
tobi
2022-03-29 11:54:56 +02:00
committed by GitHub
parent 983e696bd6
commit 37d310f981
16 changed files with 420 additions and 183 deletions

View File

@@ -199,10 +199,14 @@ func (p *processor) processNote(ctx context.Context, note string, accountID stri
return "", err
}
mentionStrings := util.DeriveMentionsFromText(note)
mentions, err := p.db.MentionStringsToMentions(ctx, mentionStrings, accountID, "")
if err != nil {
return "", err
mentionStrings := util.DeriveMentionNamesFromText(note)
mentions := []*gtsmodel.Mention{}
for _, mentionString := range mentionStrings {
mention, err := p.parseMention(ctx, mentionString, accountID, "")
if err != nil {
continue
}
mentions = append(mentions, mention)
}
// TODO: support emojis in account notes