summaryrefslogtreecommitdiff
path: root/internal/text/common.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-08-25 15:34:33 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-25 15:34:33 +0200
commit2dc9fc1626507bb54417fc4a1920b847cafb27a2 (patch)
tree4ddeac479b923db38090aac8bd9209f3646851c1 /internal/text/common.go
parentManually approves followers (#146) (diff)
downloadgotosocial-2dc9fc1626507bb54417fc4a1920b847cafb27a2.tar.xz
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
Diffstat (limited to 'internal/text/common.go')
-rw-r--r--internal/text/common.go9
1 files changed, 5 insertions, 4 deletions
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 := &gtsmodel.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 {