summaryrefslogtreecommitdiff
path: root/internal/db/bundb/bundb.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/bundb.go')
-rw-r--r--internal/db/bundb/bundb.go24
1 files changed, 2 insertions, 22 deletions
diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go
index 6bf3571b4..b944ae3ea 100644
--- a/internal/db/bundb/bundb.go
+++ b/internal/db/bundb/bundb.go
@@ -154,6 +154,7 @@ func NewBunDBService(ctx context.Context) (db.DB, error) {
// Create DB structs that require ptrs to each other
accounts := &accountDB{conn: conn, cache: cache.NewAccountCache()}
status := &statusDB{conn: conn, cache: cache.NewStatusCache()}
+ emoji := &emojiDB{conn: conn, cache: cache.NewEmojiCache()}
timeline := &timelineDB{conn: conn}
// Setup DB cross-referencing
@@ -188,9 +189,7 @@ func NewBunDBService(ctx context.Context) (db.DB, error) {
conn: conn,
cache: blockCache,
},
- Emoji: &emojiDB{
- conn: conn,
- },
+ Emoji: emoji,
Instance: &instanceDB{
conn: conn,
},
@@ -440,22 +439,3 @@ func (ps *bunDBService) TagStringsToTags(ctx context.Context, tags []string, ori
}
return newTags, nil
}
-
-func (ps *bunDBService) EmojiStringsToEmojis(ctx context.Context, emojis []string) ([]*gtsmodel.Emoji, error) {
- newEmojis := []*gtsmodel.Emoji{}
- for _, e := range emojis {
- emoji := &gtsmodel.Emoji{}
- err := ps.conn.NewSelect().Model(emoji).Where("shortcode = ?", e).Where("visible_in_picker = true").Where("disabled = false").Scan(ctx)
- if err != nil {
- if err == sql.ErrNoRows {
- // no result found for this username/domain so just don't include it as an emoji and carry on about our business
- log.Debugf("no emoji found with shortcode %s, skipping it", e)
- continue
- }
- // a serious error has happened so bail
- return nil, fmt.Errorf("error getting emoji with shortcode %s: %s", e, err)
- }
- newEmojis = append(newEmojis, emoji)
- }
- return newEmojis, nil
-}