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
This commit is contained in:
tobi 2021-08-25 15:34:33 +02:00 committed by GitHub
commit 2dc9fc1626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
713 changed files with 98694 additions and 22704 deletions

View file

@ -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 {