1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-17 10:56:24 -07:00

make RecentPostsWithNoFile work, incrase default recent posts to 12

This commit is contained in:
Eggbertx 2022-12-17 11:05:48 -08:00
parent 1bd42b6cab
commit 3b131e1399
5 changed files with 10 additions and 6 deletions

View file

@ -42,13 +42,17 @@ func getRecentPosts() ([]recentPost, error) {
SELECT id, board_id FROM DBPREFIXthreads
) t ON t.id = DBPREFIXposts.thread_id
LEFT JOIN (
select post_id, filename FROM DBPREFIXfiles
select post_id, COALESCE(filename,'') as filename FROM DBPREFIXfiles
) f on f.post_id = DBPREFIXposts.id
INNER JOIN (
SELECT
id, thread_id FROM DBPREFIXposts WHERE is_top_post
) op ON op.thread_id = DBPREFIXposts.thread_id
WHERE DBPREFIXposts.is_deleted = FALSE LIMIT ` + strconv.Itoa(siteCfg.MaxRecentPosts)
WHERE DBPREFIXposts.is_deleted = FALSE`
if !siteCfg.RecentPostsWithNoFile {
query += ` AND f.filename != '' AND f.filename != 'deleted'`
}
query += ` LIMIT ` + strconv.Itoa(siteCfg.MaxRecentPosts)
rows, err := gcsql.QuerySQL(query)
if err != nil {
return nil, err

View file

@ -30,7 +30,7 @@ var (
"SiteName": "Gochan",
"MinifyHTML": true,
"MinifyJS": true,
"MaxRecentPosts": 3,
"MaxRecentPosts": 12,
"EnableAppeals": true,
"MaxLogDays": 14,

View file

@ -107,7 +107,7 @@ const (
"EnableGeoIP": true,
"_comment": "set GeoIPDBlocation to cf to use Cloudflare's GeoIP",
"GeoIPDBlocation": "/usr/share/GeoIP/GeoIP.dat",
"MaxRecentPosts": 3,
"MaxRecentPosts": 12,
"RecentPostsWithNoFile": false,
"Verbosity": 0,
"EnableAppeals": true,

View file

@ -160,7 +160,7 @@ func InitConfig(versionStr string) {
MaxLogDays: 14,
Verbosity: 1,
MaxRecentPosts: 3,
MaxRecentPosts: 12,
RecentPostsWithNoFile: false,
},
BoardConfig: BoardConfig{

View file

@ -88,7 +88,7 @@
"EnableGeoIP": true,
"_comment": "set GeoIPDBlocation to cf to use Cloudflare's GeoIP",
"GeoIPDBlocation": "/usr/share/GeoIP/GeoIP.dat",
"MaxRecentPosts": 3,
"MaxRecentPosts": 12,
"RecentPostsWithNoFile": false,
"Verbosity": 0,
"EnableAppeals": true,