mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 14:22:33 +03:00
feat: make sage possible
This commit is contained in:
parent
10207952e2
commit
89487cda3b
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div class="row">
|
||||
{{ if ne .FirstPostID 0 }}
|
||||
<div class="col">
|
||||
<input class="form-check-input" type="checkbox" value="" id="postSage" name="sage">
|
||||
<input class="form-check-input" type="checkbox" value="on" id="postSage" name="sage">
|
||||
<label class="form-check-label" for="postSage">
|
||||
Sage
|
||||
</label>
|
||||
|
Loading…
Reference in New Issue
Block a user