From 37d310f981f3e26bc643aeabac134b591c84455a Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 29 Mar 2022 11:54:56 +0200 Subject: [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 --- internal/processing/account/update.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'internal/processing/account/update.go') diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go index a96b44bef..a0056563b 100644 --- a/internal/processing/account/update.go +++ b/internal/processing/account/update.go @@ -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 -- cgit v1.2.3