From 2dc9fc1626507bb54417fc4a1920b847cafb27a2 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Wed, 25 Aug 2021 15:34:33 +0200 Subject: Pg to bun (#148) * start moving to bun * changing more stuff * more * and yet more * tests passing * seems stable now * more big changes * small fix * little fixes --- internal/text/common.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'internal/text/common.go') diff --git a/internal/text/common.go b/internal/text/common.go index af77521dd..a8d585a09 100644 --- a/internal/text/common.go +++ b/internal/text/common.go @@ -19,6 +19,7 @@ package text import ( + "context" "fmt" "html" "strings" @@ -59,7 +60,7 @@ func postformat(in string) string { return mini } -func (f *formatter) ReplaceTags(in string, tags []*gtsmodel.Tag) string { +func (f *formatter) ReplaceTags(ctx context.Context, in string, tags []*gtsmodel.Tag) string { return util.HashtagFinderRegex.ReplaceAllStringFunc(in, func(match string) string { // we have a match matchTrimmed := strings.TrimSpace(match) @@ -88,7 +89,7 @@ func (f *formatter) ReplaceTags(in string, tags []*gtsmodel.Tag) string { }) } -func (f *formatter) ReplaceMentions(in string, mentions []*gtsmodel.Mention) string { +func (f *formatter) ReplaceMentions(ctx context.Context, in string, mentions []*gtsmodel.Mention) string { for _, menchie := range mentions { // make sure we have a target account, either by getting one pinned on the mention, // or by pulling it from the database @@ -97,8 +98,8 @@ func (f *formatter) ReplaceMentions(in string, mentions []*gtsmodel.Mention) str // got it from the mention targetAccount = menchie.OriginAccount } else { - a := >smodel.Account{} - if err := f.db.GetByID(menchie.TargetAccountID, a); err == nil { + a, err := f.db.GetAccountByID(ctx, menchie.TargetAccountID) + if err == nil { // got it from the db targetAccount = a } else { -- cgit v1.2.3