mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-30 09:56:23 -07:00
Add Cyclical field to catalogThreadData and update related post query handling
This commit is contained in:
parent
83f8601334
commit
98ccdfaff4
3 changed files with 9 additions and 1 deletions
|
@ -83,6 +83,7 @@ func BuildBoardPages(board *gcsql.Board, errEv *zerolog.Event) error {
|
|||
Locked: boolToInt(thread.Locked),
|
||||
Stickied: boolToInt(thread.Stickied),
|
||||
IsSpoilered: boolToInt(thread.IsSpoilered),
|
||||
Cyclical: boolToInt(thread.Cyclical),
|
||||
}
|
||||
errEv.Int("threadID", thread.ID)
|
||||
if catalogThread.Images, err = thread.GetReplyFileCount(); err != nil {
|
||||
|
|
|
@ -20,6 +20,7 @@ type catalogThreadData struct {
|
|||
OmittedImages int `json:"omitted_images"` // uploads in the thread but not shown on the board page
|
||||
Stickied int `json:"sticky"`
|
||||
IsSpoilered int `json:"spoilered"`
|
||||
Cyclical int `json:"cyclical"`
|
||||
Locked int `json:"closed"`
|
||||
Posts []*Post `json:"-"`
|
||||
uploads []gcsql.Upload
|
||||
|
|
|
@ -207,17 +207,23 @@ func QueryPosts(query string, params []any, cb func(*Post) error) error {
|
|||
dest = append(dest, &ip)
|
||||
}
|
||||
var lastBump time.Time
|
||||
var spoilerFile bool
|
||||
dest = append(dest,
|
||||
&post.Name, &post.Tripcode, &post.IsSecureTripcode, &post.Email, &post.Subject, &post.CreatedOn,
|
||||
&post.LastModified, &post.ParentID, &lastBump, &post.Message, &post.MessageRaw, &post.BoardID,
|
||||
&post.BoardDir, &post.OriginalFilename, &post.Filename, &post.Checksum, &post.Filesize,
|
||||
&post.ThumbnailWidth, &post.ThumbnailHeight, &post.UploadWidth, &post.UploadHeight, &post.SpoilerFile,
|
||||
&post.ThumbnailWidth, &post.ThumbnailHeight, &post.UploadWidth, &post.UploadHeight, &spoilerFile,
|
||||
&post.thread.Locked, &post.thread.Stickied, &post.thread.Cyclical, &post.thread.IsSpoilered,
|
||||
&post.Country.Flag, &post.Country.Name, &post.IsDeleted)
|
||||
|
||||
if err = rows.Scan(dest...); err != nil {
|
||||
return err
|
||||
}
|
||||
if spoilerFile {
|
||||
post.SpoilerFile = 1
|
||||
} else {
|
||||
post.SpoilerFile = 0
|
||||
}
|
||||
if sqlCfg.DBtype != "mysql" {
|
||||
post.IP = net.ParseIP(ip)
|
||||
if post.IP == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue