🐛 Bug fixes in feed & recommendations
This commit is contained in:
parent
0fa75406ed
commit
b4c78cd10c
@ -37,9 +37,9 @@ func listRecommendation(c *fiber.Ctx) error {
|
|||||||
return item.ID, *item
|
return item.ID, *item
|
||||||
})
|
})
|
||||||
|
|
||||||
// Revert the position
|
// Revert the position & truncate
|
||||||
for idx, item := range posts {
|
for idx, item := range posts {
|
||||||
posts[idx] = newPostMap[item.ID]
|
posts[idx] = services.TruncatePostContent(newPostMap[item.ID])
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(posts)
|
return c.JSON(posts)
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
|
||||||
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
"git.solsynth.dev/hypernet/interactive/pkg/internal/models"
|
||||||
"git.solsynth.dev/hypernet/interactive/pkg/proto"
|
"git.solsynth.dev/hypernet/interactive/pkg/proto"
|
||||||
|
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
@ -128,7 +129,7 @@ func ListNewsForFeed(limit int, cursor *time.Time) ([]FeedEntry, error) {
|
|||||||
return lo.Map(resp.Items, func(item *proto.FeedItem, _ int) FeedEntry {
|
return lo.Map(resp.Items, func(item *proto.FeedItem, _ int) FeedEntry {
|
||||||
return FeedEntry{
|
return FeedEntry{
|
||||||
Type: item.Type,
|
Type: item.Type,
|
||||||
Data: item.Content,
|
Data: nex.DecodeMap(item.Content),
|
||||||
CreatedAt: time.UnixMilli(int64(item.CreatedAt)),
|
CreatedAt: time.UnixMilli(int64(item.CreatedAt)),
|
||||||
}
|
}
|
||||||
}), nil
|
}), nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user