summaryrefslogtreecommitdiff
path: root/internal/typeutils/converter.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-06-11 11:01:34 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-11 11:01:34 +0200
commitdfdc473cefa255c5d0fb6c2e90e2b90815305c2f (patch)
treeaf3bbc5398ac24acbb2ca1158edfef8517344f8a /internal/typeutils/converter.go
parent[feature] Add `created_at` and `error_description` to `/oauth/token` endpoint... (diff)
downloadgotosocial-dfdc473cefa255c5d0fb6c2e90e2b90815305c2f.tar.xz
[chore] Webfinger rework (#627)
* move finger to dereferencer * totally break GetRemoteAccount * start reworking finger func a bit * start reworking getRemoteAccount a bit * move mention parts to namestring * rework webfingerget * use util function to extract webfinger parts * use accountDomain * rework finger again, final form * just a real nasty commit, the worst * remove refresh from account * use new ASRepToAccount signature * fix incorrect debug call * fix for new getRemoteAccount * rework GetRemoteAccount * start updating tests to remove repetition * break a lot of tests Move shared test logic into the testrig, rather than having it scattered all over the place. This allows us to just mock the transport controller once, and have all tests use it (unless they need not to for some other reason). * fix up tests to use main mock httpclient * webfinger only if necessary * cheeky linting with the lads * update mentionName regex recognize instance accounts * don't finger instance accounts * test webfinger part extraction * increase default worker count to 4 per cpu * don't repeat regex parsing * final search for discovered accountDomain * be more permissive in namestring lookup * add more extraction tests * simplify GetParseMentionFunc * skip long search if local account * fix broken test
Diffstat (limited to 'internal/typeutils/converter.go')
-rw-r--r--internal/typeutils/converter.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/typeutils/converter.go b/internal/typeutils/converter.go
index cf1a9d487..b2f12a592 100644
--- a/internal/typeutils/converter.go
+++ b/internal/typeutils/converter.go
@@ -99,7 +99,10 @@ type TypeConverter interface {
// If update is false, and the account is already known in the database, then the existing account entry will be returned.
// If update is true, then even if the account is already known, all fields in the accountable will be parsed and a new *gtsmodel.Account
// will be generated. This is useful when one needs to force refresh of an account, eg., during an Update of a Profile.
- ASRepresentationToAccount(ctx context.Context, accountable ap.Accountable, update bool) (*gtsmodel.Account, error)
+ //
+ // If accountDomain is set (not an empty string) then this value will be used as the account's Domain. If not set,
+ // then the Host of the accountable's AP ID will be used instead.
+ ASRepresentationToAccount(ctx context.Context, accountable ap.Accountable, accountDomain string, update bool) (*gtsmodel.Account, error)
// ASStatus converts a remote activitystreams 'status' representation into a gts model status.
ASStatusToStatus(ctx context.Context, statusable ap.Statusable) (*gtsmodel.Status, error)
// ASFollowToFollowRequest converts a remote activitystreams `follow` representation into gts model follow request.