1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-20 09:26:23 -07:00

Execute board creation SQL before creating dir, resolves issue #27

This commit is contained in:
Eggbertx 2022-02-24 17:21:33 -08:00
parent 8840693a8b
commit 60fd5451bf

View file

@ -313,6 +313,16 @@ func buildBoard(board *gcsql.Board, newBoard, force bool) error {
return ErrNoBoardTitle
}
if newBoard {
board.CreatedOn = time.Now()
err := gcsql.CreateBoard(board)
if err != nil {
return err
}
} else if err = board.UpdateID(); err != nil {
return err
}
dirPath := board.AbsolutePath()
resPath := board.AbsolutePath("res")
srcPath := board.AbsolutePath("src")
@ -378,15 +388,6 @@ func buildBoard(board *gcsql.Board, newBoard, force bool) error {
genericErrStr, thumbPath, err.Error()))
}
if newBoard {
board.CreatedOn = time.Now()
err := gcsql.CreateBoard(board)
if err != nil {
return err
}
} else if err = board.UpdateID(); err != nil {
return err
}
BuildBoardPages(board)
BuildThreads(true, board.ID, 0)
gcsql.ResetBoardSectionArrays()