repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
65e4a7a
parent
0fc145b
author
Eric Bower
date
2026-01-02 12:38:06 -0500 EST
fix(prose): filter aliases by user_id

This was erroneously showing posts from other users
1 files changed,  +6, -1
M pkg/db/postgres/storage.go
+6, -1
 1@@ -391,7 +391,12 @@ func (me *PsqlDB) FindPostWithSlug(slug string, user_id string, space string) (*
 2 	post, err := CreatePostWithTagsByRow(r)
 3 	if err != nil {
 4 		// attempt to find post inside post_aliases
 5-		alias := me.Db.QueryRow(`SELECT post_id FROM post_aliases WHERE slug = $1`, slug)
 6+		alias := me.Db.QueryRow(
 7+			`SELECT post_aliases.post_id FROM post_aliases
 8+			INNER JOIN posts ON posts.id = post_aliases.post_id
 9+			WHERE post_aliases.slug = $1 AND posts.user_id = $2`,
10+			slug, user_id,
11+		)
12 		postID := ""
13 		err := alias.Scan(&postID)
14 		if err != nil {