diff options
Diffstat (limited to 'internal/store/pages.go')
| -rw-r--r-- | internal/store/pages.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/store/pages.go b/internal/store/pages.go index 55cad33..3d5b02d 100644 --- a/internal/store/pages.go +++ b/internal/store/pages.go @@ -105,8 +105,10 @@ func (bs *BlogStore) UpdatePage(ctx context.Context, p *Page) error { } func (bs *BlogStore) DeletePage(ctx context.Context, id int64) error { - _, err := bs.db.Exec(ctx, `DELETE FROM pages WHERE id=$1 AND NOT is_home`, id) - return err + if _, err := bs.db.Exec(ctx, `DELETE FROM pages WHERE id=$1 AND NOT is_home`, id); err != nil { + return err + } + return deleteOrphanTags(ctx, bs.db) // its posts went with it } // SetHomePage moves the home flag to the given page. |
