diff --git a/controllers/threads_controller.go b/controllers/threads_controller.go index d2a7938..784f3a4 100644 --- a/controllers/threads_controller.go +++ b/controllers/threads_controller.go @@ -254,7 +254,7 @@ func UpdateThread(c *gin.Context) { if len(isSageField) != 0 { isSageString = isSageField[0] } - isSage := isSageString == "true" + isSage := isSageString == "on" conn, err := Db.Pool.Acquire(context.TODO()) if err != nil { diff --git a/repositories/posts_repository.go b/repositories/posts_repository.go index 804da5b..a33b3ee 100644 --- a/repositories/posts_repository.go +++ b/repositories/posts_repository.go @@ -188,7 +188,7 @@ func (r *PostsRepository) CreateInTx(tx pgx.Tx, p Post) (int, error) { } // updating parent post `updated_at` - if !p.IsParent { + if !p.IsParent && !p.IsSage { sql = ` UPDATE posts SET updated_at = now() @@ -197,6 +197,8 @@ func (r *PostsRepository) CreateInTx(tx pgx.Tx, p Post) (int, error) { row := tx.QueryRow(context.TODO(), sql, p.ParentID) var msg string err = row.Scan(&msg) + // UPDATE always return `no rows` + // so we need to check this condition if err != nil && err != pgx.ErrNoRows { return 0, err } diff --git a/templates/post-form.html b/templates/post-form.html index 6990d21..c4ae8de 100644 --- a/templates/post-form.html +++ b/templates/post-form.html @@ -24,7 +24,7 @@