Skip to content

Commit

Permalink
Fix failing tests, move more inline CSS to global CSS files
Browse files Browse the repository at this point in the history
  • Loading branch information
Eggbertx committed Dec 1, 2024
1 parent b6e7427 commit 9fb0892
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 115 deletions.
19 changes: 18 additions & 1 deletion frontend/sass/global/_bans.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,21 @@

form#appeal-form * {
display: block;
}
}

.banpage-block {
margin: 0px 26px 0px 24px;

.section-body {
padding-top: 8px;
}
}

#ban-info {
float: left;
}

img#banpage-image {
float: right;
margin: 4px 8px 8px 4px;
}
16 changes: 16 additions & 0 deletions html/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,22 @@ form#appeal-form * {
display: block;
}

.banpage-block {
margin: 0px 26px 0px 24px;
}
.banpage-block .section-body {
padding-top: 8px;
}

#ban-info {
float: left;
}

img#banpage-image {
float: right;
margin: 4px 8px 8px 4px;
}

header {
margin-top: 50px;
text-align: center;
Expand Down
11 changes: 6 additions & 5 deletions pkg/building/building.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ func BuildFrontPage() error {
// of every normal HTML page
func BuildPageHeader(writer io.Writer, pageTitle string, board string, misc map[string]interface{}) error {
phMap := map[string]interface{}{
"pageTitle": pageTitle,
"siteConfig": config.GetSiteConfig(),
"sections": gcsql.AllSections,
"boards": gcsql.AllBoards,
"boardConfig": config.GetBoardConfig(board),
"pageTitle": pageTitle,
"documentTitle": pageTitle + " - " + config.GetSiteConfig().SiteName,
"siteConfig": config.GetSiteConfig(),
"sections": gcsql.AllSections,
"boards": gcsql.AllBoards,
"boardConfig": config.GetBoardConfig(board),
}
for k, val := range misc {
phMap[k] = val
Expand Down
11 changes: 1 addition & 10 deletions pkg/building/building_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,7 @@ func doFrontBuildingTest(t *testing.T, mock sqlmock.Sqlmock, expectOut string) {
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "abbreviation", "position", "hidden"}).
AddRows([]driver.Value{1, "Main", "main", 1, false}))

mock.ExpectPrepare(`SELECT\s*posts.id,\s*posts.message_raw,\s*` +
`\(SELECT dir FROM boards WHERE id = t.board_id\),\s*` +
`COALESCE\(f.filename, ''\), op.id\s*` +
`FROM posts\s*` +
`LEFT JOIN\s*\(SELECT id, board_id FROM threads\) t ON t.id = posts.thread_id\s+` +
`LEFT JOIN\s*\(SELECT post_id, filename FROM files\) f on f.post_id = posts.id\s+` +
`INNER JOIN\s*\(SELECT id, thread_id FROM posts WHERE is_top_post\) op ON op.thread_id = posts.thread_id\s+` +
`WHERE posts.is_deleted = FALSE\s+` +
`AND f.filename IS NOT NULL AND f.filename != '' AND f.filename != 'deleted'\s+` +
`ORDER BY posts.id DESC LIMIT \d+`).ExpectQuery().WillReturnRows(
mock.ExpectPrepare(`SELECT \* FROM v_front_page_posts_with_file ORDER BY id DESC LIMIT 15`).ExpectQuery().WillReturnRows(
sqlmock.NewRows([]string{"posts.id", "posts.message_raw", "dir", "filename", "op.id"}).
AddRows(
[]driver.Value{1, "message_raw", "test", "filename", 1},
Expand Down
6 changes: 3 additions & 3 deletions pkg/building/buildingconsts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ var defaultStyle = "test1.css";
var webroot = "/chan";
var serverTZ = 8;
var fileTypes = [];`
expectedMinifiedFront = `<!doctype html><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Gochan</title><link rel=stylesheet href=/chan/css/global.css><link id=theme rel=stylesheet href=/chan/css/test1.css><link rel="shortcut icon" href=/chan/favicon.png><script src=/chan/js/consts.js></script><script src=/chan/js/gochan.js></script><div id=topbar><div class=topbar-section><a href=/chan/ class=topbar-item>home</a></div><div class=topbar-section><a href=/chan/test/ class=topbar-item title="Testing board">/test/</a><a href=/chan/test2/ class=topbar-item title="Testing board 2">/test2/</a></div></div><div id=content><div id=top-pane><span id=site-title>Gochan</span><br><span id=site-slogan></span></div><br><div id=frontpage><div class=section-block style="margin: 16px 64px 16px 64px;"><div class="section-body front-intro">Welcome to Gochan!</div></div><div class=section-block><div class=section-title-block><b>Boards</b></div><div class=section-body><ul style="float:left; list-style: none"><li style="text-align: center; font-weight: bold"><b><u>Main</u></b><li><a href=/chan/test/ title="Board for testing description">/test/</a> — Testing board<li><a href=/chan/test2/ title="Board for testing description 2">/test2/</a> — Testing board 2</ul></div></div><div class=section-block><div class=section-title-block><b>Recent Posts</b></div><div class=section-body><div id=recent-posts><div class=recent-post><a href=/chan/test/res/1.html#1 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div><div class=recent-post><a href=/chan/test/res/1.html#2 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div></div></div></div></div><div id=footer>Powered by <a href=http://github.com/gochan-org/gochan/>Gochan 3.11</a><br></div></div>`
expectedMinifiedFront = `<!doctype html><html lang=en><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Gochan</title><link rel=stylesheet href=/chan/css/global.css><link id=theme rel=stylesheet href=/chan/css/test1.css><link rel="shortcut icon" href=/chan/favicon.png><script src=/chan/js/consts.js></script><script src=/chan/js/gochan.js></script><div id=topbar><div class=topbar-section><a href=/chan/ class=topbar-item>home</a></div><div class=topbar-section><a href=/chan/test/ class=topbar-item title="Testing board">/test/</a><a href=/chan/test2/ class=topbar-item title="Testing board 2">/test2/</a></div></div><div id=content><div id=top-pane><h1 id=site-title>Gochan</h1><span id=site-slogan></span></div><br><div id=frontpage><div class=section-block style="margin: 16px 64px 16px 64px;"><div class="section-body front-intro">Welcome to Gochan!</div></div><div class=section-block><div class=section-title-block><b>Boards</b></div><div class=section-body><ul style="float:left; list-style: none"><li style="text-align: center; font-weight: bold"><b><u>Main</u></b><li><a href=/chan/test/ title="Board for testing description">/test/</a> — Testing board<li><a href=/chan/test2/ title="Board for testing description 2">/test2/</a> — Testing board 2</ul></div></div><div class=section-block><div class=section-title-block><b>Recent Posts</b></div><div class=section-body><div id=recent-posts><div class=recent-post><a href=/chan/test/res/1.html#1 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div><div class=recent-post><a href=/chan/test/res/1.html#2 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div></div></div></div></div><div id=footer>Powered by <a href=http://github.com/gochan-org/gochan/>Gochan 3.11</a><br></div></div>`
expectedUnminifiedFront = `<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand All @@ -25,7 +25,7 @@ var fileTypes = [];`
<div id="content">
<div id="top-pane">
<span id="site-title">Gochan</span><br />
<h1 id="site-title">Gochan</h1>
<span id="site-slogan"></span>
</div><br />
<div id="frontpage">
Expand Down
5 changes: 0 additions & 5 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ func TestValidateValues(t *testing.T) {
SetRandomSeed("test")
assert.NoError(t, cfg.ValidateValues())

cfg.ListenIP = "not an IP"
assert.Error(t, cfg.ValidateValues())
cfg.ListenIP = "127.0.0.1"
assert.NoError(t, cfg.ValidateValues())

cfg.CookieMaxAge = "not a duration"
assert.Error(t, cfg.ValidateValues())
cfg.CookieMaxAge = "1y"
Expand Down
Loading

0 comments on commit 9fb0892

Please sign in to comment.