A community based topic aggregation platform built on atproto

fix(db): fix pointer reuse bug in ListBlockedCommunities

Critical bug fix: The loop variable 'block' was being reused for each
iteration, causing all elements in the returned slice to point to the
same memory location. This resulted in the last row being repeated for
every element when callers read the list.

Fixed by allocating a new block pointer for each iteration:
- Before: var block communities.CommunityBlock (reused)
- After: block := &communities.CommunityBlock{} (new allocation)

Also replaced fmt.Printf with log.Printf for consistency with project
logging standards.

Addresses: P1 review comment - pointer reuse in list operation

+5 -3
+5 -3
internal/db/postgres/community_repo_blocks.go
··· 5 5 "context" 6 6 "database/sql" 7 7 "fmt" 8 + "log" 8 9 ) 9 10 10 11 // BlockCommunity creates a new block record (idempotent) ··· 123 124 defer func() { 124 125 if closeErr := rows.Close(); closeErr != nil { 125 126 // Log error but don't override the main error 126 - fmt.Printf("Failed to close rows: %v\n", closeErr) 127 + log.Printf("Failed to close rows: %v", closeErr) 127 128 } 128 129 }() 129 130 130 131 var blocks []*communities.CommunityBlock 131 132 for rows.Next() { 132 - var block communities.CommunityBlock 133 + // Allocate a new block for each iteration to avoid pointer reuse bug 134 + block := &communities.CommunityBlock{} 133 135 134 136 err = rows.Scan( 135 137 &block.ID, ··· 143 145 return nil, fmt.Errorf("failed to scan block: %w", err) 144 146 } 145 147 146 - blocks = append(blocks, &block) 148 + blocks = append(blocks, block) 147 149 } 148 150 149 151 if err = rows.Err(); err != nil {