summaryrefslogtreecommitdiff
path: root/internal/processing/search.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-03-29 11:54:56 +0200
committerLibravatar GitHub <noreply@github.com>2022-03-29 11:54:56 +0200
commit37d310f981f3e26bc643aeabac134b591c84455a (patch)
tree041f5db16254b5257471bcac0730ac9d93ce13d5 /internal/processing/search.go
parent[feature/security] Add systemd sandboxing options to harden security (#440) (diff)
downloadgotosocial-37d310f981f3e26bc643aeabac134b591c84455a.tar.xz
[feature] Dereference remote mentions when the account is not already known (#442)v0.2.2
* 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
Diffstat (limited to 'internal/processing/search.go')
-rw-r--r--internal/processing/search.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/internal/processing/search.go b/internal/processing/search.go
index c8c302857..6c3d7da39 100644
--- a/internal/processing/search.go
+++ b/internal/processing/search.go
@@ -194,20 +194,15 @@ func (p *processor) searchAccountByMention(ctx context.Context, authed *oauth.Au
// we got a db.ErrNoEntries, so we just don't have the account locally stored -- check if we can dereference it
if resolve {
// we're allowed to resolve it so let's try
-
// first we need to webfinger the remote account to convert the username and domain into the activitypub URI for the account
acctURI, err := p.federator.FingerRemoteAccount(ctx, authed.Account.Username, username, domain)
if err != nil {
// something went wrong doing the webfinger lookup so we can't process the request
- return nil, fmt.Errorf("searchAccountByMention: error fingering remote account with username %s and domain %s: %s", username, domain, err)
+ return nil, fmt.Errorf("error fingering remote account with username %s and domain %s: %s", username, domain, err)
}
- // we don't have it locally so try and dereference it
- account, err := p.federator.GetRemoteAccount(ctx, authed.Account.Username, acctURI, true, true)
- if err != nil {
- return nil, fmt.Errorf("searchAccountByMention: error dereferencing account with uri %s: %s", acctURI.String(), err)
- }
- return account, nil
+ // return the attempt to get the remove account
+ return p.federator.GetRemoteAccount(ctx, authed.Account.Username, acctURI, true, true)
}
return nil, nil