🐛 Fixed attachment loading in ListPostV2
This commit is contained in:
		@@ -1,8 +1,8 @@
 | 
				
			|||||||
package queries
 | 
					package queries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/json"
 | 
					 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"github.com/goccy/go-json"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
 | 
						"git.solsynth.dev/hypernet/interactive/pkg/internal/database"
 | 
				
			||||||
	"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
 | 
						"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
 | 
				
			||||||
@@ -90,10 +90,12 @@ func ListPostV2(tx *gorm.DB, take int, offset int, order any, user *uint) ([]mod
 | 
				
			|||||||
	var attachmentsRid []string
 | 
						var attachmentsRid []string
 | 
				
			||||||
	var usersId []uint
 | 
						var usersId []uint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Scan records that can be load egearly
 | 
						// Scan records that can be load eagerly
 | 
				
			||||||
	var bodies []models.PostStoryBody
 | 
						var bodies []models.PostStoryBody
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		raw, _ := json.Marshal(posts)
 | 
							raw, _ := json.Marshal(lo.Map(posts, func(item models.Post, _ int) map[string]any {
 | 
				
			||||||
 | 
								return item.Body
 | 
				
			||||||
 | 
							}))
 | 
				
			||||||
		json.Unmarshal(raw, &bodies)
 | 
							json.Unmarshal(raw, &bodies)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for idx, info := range posts {
 | 
						for idx, info := range posts {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,8 +14,8 @@ print_routes = false
 | 
				
			|||||||
[security]
 | 
					[security]
 | 
				
			||||||
internal_public_key = "keys/internal_public_key.pem"
 | 
					internal_public_key = "keys/internal_public_key.pem"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[fediverse.friends]]
 | 
					#[[fediverse.friends]]
 | 
				
			||||||
id = "mastodon-social"
 | 
					#id = "mastodon-social"
 | 
				
			||||||
url = "https://mastodon.social"
 | 
					#url = "https://mastodon.social"
 | 
				
			||||||
type = "mastodon"
 | 
					#type = "mastodon"
 | 
				
			||||||
batch_size = 50
 | 
					#batch_size = 50
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user