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/util/statustools.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'internal/util/statustools.go') diff --git a/internal/util/statustools.go b/internal/util/statustools.go index bb87c23fa..08032a8f4 100644 --- a/internal/util/statustools.go +++ b/internal/util/statustools.go @@ -25,13 +25,11 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/regexes" ) -// DeriveMentionsFromText takes a plaintext (ie., not html-formatted) text, -// and applies a regex to it to return a deduplicated list of accounts -// mentioned in that text. -// -// It will look for fully-qualified account names in the form "@user@example.org". -// or the form "@username" for local users. -func DeriveMentionsFromText(text string) []string { +// DeriveMentionNamesFromText takes a plaintext (ie., not html-formatted) text, +// and applies a regex to it to return a deduplicated list of account names +// mentioned in that text, in the format "@user@example.org" or "@username" for +// local users. +func DeriveMentionNamesFromText(text string) []string { mentionedAccounts := []string{} for _, m := range regexes.MentionFinder.FindAllStringSubmatch(text, -1) { mentionedAccounts = append(mentionedAccounts, m[1]) -- cgit v1.2.3