set up show/hide of controls on topic page

This commit is contained in:
2026-01-15 22:59:27 -07:00
parent dd7b3d7858
commit d0c84216c3
4 changed files with 158 additions and 52 deletions
+14
View File
@@ -44,6 +44,20 @@ func (p *PostHeader) IsScribbled() bool {
return p.ScribbleUid != nil && p.ScribbleDate != nil
}
// IsPublished returns true if the post has been published to the front page.
func (p *PostHeader) IsPublished(ctx context.Context) (bool, error) {
rs, err := amdb.QueryContext(ctx, "SELECT COUNT(*) FROM postpublish WHERE postid = ?", p.PostId)
if err != nil {
return false, err
}
if !rs.Next() {
return false, errors.New("internal failure in IsPublished")
}
ct := 0
err = rs.Scan(&ct)
return ct > 0, err
}
/* SetAttachment sets the attachment data for a post.
* Parameters:
* ctx - Standard Go context value.