From 04bc4e50357b4f9a174515deb9d5deeb01018101 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Mon, 17 Jun 2024 21:30:37 -0500 Subject: [PATCH] Remove light/dark theme settings entirely There is simply no need any more; system light/dark preferences handle this fine. --- .../2024-06-18T022536Z_RemoveDarkTheme.go | 47 ++++++++++++++++ src/models/user.go | 3 +- src/rawdata/bgdark.png | Bin 2129 -> 0 bytes src/rawdata/bglight.png | Bin 2125 -> 0 bytes src/templates/mapping.go | 53 ++++++++---------- src/templates/src/fishbowl.html | 15 +++-- .../src/include/showcase_templates.html | 48 ++++++++++++++++ src/templates/src/layouts/base.html | 20 ------- .../src/layouts/jam_2023_visibility_base.html | 13 +++-- .../src/layouts/wheeljam_2022_base.html | 13 +++-- .../src/layouts/wheeljam_2023_base.html | 13 +++-- src/templates/src/user_settings.html | 8 --- src/templates/types.go | 2 - src/website/admin.go | 13 ++--- src/website/base_data.go | 3 +- src/website/blogs.go | 10 ++-- src/website/common.go | 9 +-- src/website/feed.go | 3 +- src/website/following.go | 2 +- src/website/forums.go | 12 ++-- src/website/jam.go | 36 ++++++------ src/website/landing.go | 6 +- src/website/post_helper.go | 3 +- src/website/projects.go | 17 +++--- src/website/requesthandling.go | 1 - src/website/snippet.go | 4 +- src/website/timeline_helper.go | 23 +++----- src/website/user.go | 13 ++--- todo-styles.md | 4 +- 29 files changed, 220 insertions(+), 174 deletions(-) create mode 100644 src/migration/migrations/2024-06-18T022536Z_RemoveDarkTheme.go delete mode 100644 src/rawdata/bgdark.png delete mode 100644 src/rawdata/bglight.png create mode 100644 src/templates/src/include/showcase_templates.html diff --git a/src/migration/migrations/2024-06-18T022536Z_RemoveDarkTheme.go b/src/migration/migrations/2024-06-18T022536Z_RemoveDarkTheme.go new file mode 100644 index 00000000..8494bd8c --- /dev/null +++ b/src/migration/migrations/2024-06-18T022536Z_RemoveDarkTheme.go @@ -0,0 +1,47 @@ +package migrations + +import ( + "context" + "time" + + "git.handmade.network/hmn/hmn/src/migration/types" + "github.com/jackc/pgx/v5" +) + +func init() { + registerMigration(RemoveDarkTheme{}) +} + +type RemoveDarkTheme struct{} + +func (m RemoveDarkTheme) Version() types.MigrationVersion { + return types.MigrationVersion(time.Date(2024, 6, 18, 2, 25, 36, 0, time.UTC)) +} + +func (m RemoveDarkTheme) Name() string { + return "RemoveDarkTheme" +} + +func (m RemoveDarkTheme) Description() string { + return "Remove the darktheme field from users" +} + +func (m RemoveDarkTheme) Up(ctx context.Context, tx pgx.Tx) error { + _, err := tx.Exec(ctx, + ` + ALTER TABLE hmn_user + DROP COLUMN darktheme; + `, + ) + return err +} + +func (m RemoveDarkTheme) Down(ctx context.Context, tx pgx.Tx) error { + _, err := tx.Exec(ctx, + ` + ALTER TABLE hmn_user + ADD COLUMN darktheme BOOLEAN NOT NULL DEFAULT FALSE; + `, + ) + return err +} diff --git a/src/models/user.go b/src/models/user.go index d838324f..d971b0c1 100644 --- a/src/models/user.go +++ b/src/models/user.go @@ -38,8 +38,7 @@ type User struct { Signature string `db:"signature"` AvatarAssetID *uuid.UUID `db:"avatar_asset_id"` - DarkTheme bool `db:"darktheme"` - Timezone string `db:"timezone"` + Timezone string `db:"timezone"` ShowEmail bool `db:"showemail"` diff --git a/src/rawdata/bgdark.png b/src/rawdata/bgdark.png deleted file mode 100644 index 52fe9688eeeed483b47e5553650587297d12e39c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2129 zcmai0e^^uX8b26Wo05_whI%_56sNS`4|sRjBw)L2u;Dg9ekC}zv+XeUgPj9xGp~qg z$&f^b1(@hE6${}iJ>DP!o_ZeaNk9=SvM>lFucBlq1eKjLNHeYb$NBMnKcDyWec$){ zzUMi+<#EwI)Bq{~06r42P)R(+#2Mj zOb8eeTm{;U*(MCO2_TOyOuUn3CIosYxIq9V%j95`*@}Q6j1UG3T2BS}R*e=`3ja0h zOsoWu9>*;(lbN5N&&cO8%vK$f&ExTyEDn>yp%V-`W;fv~8{LEjk`gl-LIhJ=Q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XSPcJyYCm-ZRkp&^|ZHn7#qb`C979&mk=F@j7 z=leHL7$flCoHnaaa=&69d;G_HN}9mmPuMdyzS&Yv;{Rmvh*>^mtk~)8_k##5yAS}D z+CP}JGn)K#ce?m}q|P&7rah?cTs_SqZ7n19v~`r*ae+VOP`i(;w9Jm@I=1zk=w4sd z*I12J&CXD@5N2zW%4f!4*C$lN*VcQ_tW#oxDXQSYM(UzdM?P+%TBnv|JcwGl4;U)0 z3TK_4^V!V}BAeSx>?QheezTz{{nJsQwxsjbaaGjHu60!5t)oYq;%;xBZfimItnc&+ d3g^p&&bL?ruz~9Yq^`e!Sb>CJGjG}IKLJnbEIt4L diff --git a/src/templates/mapping.go b/src/templates/mapping.go index f8c22b3f..390061ef 100644 --- a/src/templates/mapping.go +++ b/src/templates/mapping.go @@ -14,7 +14,7 @@ import ( "git.handmade.network/hmn/hmn/src/models" ) -func PostToTemplate(p *models.Post, author *models.User, currentTheme string) Post { +func PostToTemplate(p *models.Post, author *models.User) Post { return Post{ ID: p.ID, @@ -23,7 +23,7 @@ func PostToTemplate(p *models.Post, author *models.User, currentTheme string) Po Preview: p.Preview, ReadOnly: p.ReadOnly, - Author: UserToTemplate(author, currentTheme), + Author: UserToTemplate(author), // No content. A lot of the time we don't have this handy and don't need it. See AddContentVersion. PostDate: p.PostDate, } @@ -34,7 +34,7 @@ func (p *Post) AddContentVersion(ver models.PostVersion, editor *models.User) { p.IP = maybeIp(ver.IP) if editor != nil { - editorTmpl := UserToTemplate(editor, "theme not required here") + editorTmpl := UserToTemplate(editor) p.Editor = &editorTmpl p.EditDate = ver.Date p.EditReason = ver.EditReason @@ -61,15 +61,13 @@ var LifecycleBadgeStrings = map[models.ProjectLifecycle]string{ models.ProjectLifecycleLTS: "Complete", } -func ProjectLogoUrl(p *models.Project, lightAsset *models.Asset, darkAsset *models.Asset, theme string) string { - if theme == "dark" { - if darkAsset != nil { - return hmnurl.BuildS3Asset(darkAsset.S3Key) - } - } else { - if lightAsset != nil { - return hmnurl.BuildS3Asset(lightAsset.S3Key) - } +// TODO(redesign): Remove one or the other of these from the database entirely. +func ProjectLogoUrl(p *models.Project, lightAsset *models.Asset, darkAsset *models.Asset) string { + if lightAsset != nil { + return hmnurl.BuildS3Asset(lightAsset.S3Key) + } + if darkAsset != nil { + return hmnurl.BuildS3Asset(darkAsset.S3Key) } return "" } @@ -100,11 +98,11 @@ func ProjectToTemplate( } } -func ProjectAndStuffToTemplate(p *hmndata.ProjectAndStuff, url string, theme string) Project { +func ProjectAndStuffToTemplate(p *hmndata.ProjectAndStuff, url string) Project { res := ProjectToTemplate(&p.Project, url) - res.Logo = ProjectLogoUrl(&p.Project, p.LogoLightAsset, p.LogoDarkAsset, theme) + res.Logo = ProjectLogoUrl(&p.Project, p.LogoLightAsset, p.LogoDarkAsset) for _, o := range p.Owners { - res.Owners = append(res.Owners, UserToTemplate(o, theme)) + res.Owners = append(res.Owners, UserToTemplate(o)) } if p.HeaderImage != nil { res.HeaderImage = hmnurl.BuildS3Asset(p.HeaderImage.S3Key) @@ -133,11 +131,10 @@ func ProjectToProjectSettings( owners []*models.User, tag string, lightLogo, darkLogo, headerImage *models.Asset, - currentTheme string, ) ProjectSettings { ownerUsers := make([]User, 0, len(owners)) for _, owner := range owners { - ownerUsers = append(ownerUsers, UserToTemplate(owner, currentTheme)) + ownerUsers = append(ownerUsers, UserToTemplate(owner)) } return ProjectSettings{ Name: p.Name, @@ -187,28 +184,23 @@ func ThreadToTemplate(t *models.Thread) Thread { } } -func UserAvatarDefaultUrl(currentTheme string) string { - return hmnurl.BuildTheme("empty-avatar.svg", currentTheme, true) +func UserAvatarDefaultUrl(theme string) string { + return hmnurl.BuildTheme("empty-avatar.svg", theme, true) } -func UserAvatarUrl(u *models.User, currentTheme string) string { - if currentTheme == "" { - currentTheme = "light" - } +func UserAvatarUrl(u *models.User) string { avatar := "" if u != nil && u.AvatarAsset != nil { avatar = hmnurl.BuildS3Asset(u.AvatarAsset.S3Key) - } else { - avatar = UserAvatarDefaultUrl(currentTheme) } return avatar } -func UserToTemplate(u *models.User, currentTheme string) User { +func UserToTemplate(u *models.User) User { if u == nil { return User{ Name: "Deleted user", - AvatarUrl: UserAvatarUrl(nil, currentTheme), + AvatarUrl: UserAvatarUrl(nil), } } @@ -231,10 +223,9 @@ func UserToTemplate(u *models.User, currentTheme string) User { Signature: u.Signature, DateJoined: u.DateJoined, ProfileUrl: hmnurl.BuildUserProfile(u.Username), - AvatarUrl: UserAvatarUrl(u, currentTheme), + AvatarUrl: UserAvatarUrl(u), - DarkTheme: u.DarkTheme, - Timezone: u.Timezone, + Timezone: u.Timezone, DiscordSaveShowcase: u.DiscordSaveShowcase, DiscordDeleteSnippetOnMessageDelete: u.DiscordDeleteSnippetOnMessageDelete, @@ -246,7 +237,7 @@ func UserToTemplate(u *models.User, currentTheme string) User { var UnknownUser = User{ Name: "Unknown User", - AvatarUrl: UserAvatarUrl(nil, ""), + AvatarUrl: UserAvatarUrl(nil), } // An online site/service for which we recognize the link diff --git a/src/templates/src/fishbowl.html b/src/templates/src/fishbowl.html index d04aecff..63e171a6 100644 --- a/src/templates/src/fishbowl.html +++ b/src/templates/src/fishbowl.html @@ -1,7 +1,9 @@ {{ template "base.html" . }} {{ define "extrahead" }} - + + + + + + + + + diff --git a/src/templates/src/layouts/base.html b/src/templates/src/layouts/base.html index 1e492e38..57cb2ce7 100644 --- a/src/templates/src/layouts/base.html +++ b/src/templates/src/layouts/base.html @@ -21,26 +21,6 @@ - - {{/* TODO: These are the base64 encodings of bglight.png and bgdark.png. Rather than manually putting the encoding here, it would be nice to automatically calculate it when the server starts up and pass it in. */}} - {{ $bglight := "iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAEGGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZT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lrUMHEZxQtt/hlGTCjaJVMuiSKEjpuiKKUjovbvKSOeaIorWOaKI7QcUMUpXQe+31Pc6xeN0AAAAAASUVORK5CYII=" }} - diff --git a/src/templates/src/layouts/jam_2023_visibility_base.html b/src/templates/src/layouts/jam_2023_visibility_base.html index 01c42002..d742aab6 100644 --- a/src/templates/src/layouts/jam_2023_visibility_base.html +++ b/src/templates/src/layouts/jam_2023_visibility_base.html @@ -37,14 +37,15 @@ /* Copy-paste from project.css yay */ {{ $c := hex2color "C8217E" }} - {{ $themeDim := eq .Theme "dark" | ternary (lightness 0.35 $c) (lightness 0.75 $c) | color2css }} - {{ $themeDimmer := eq .Theme "dark" | ternary (lightness 0.3 $c) (lightness 0.8 $c) | color2css }} - {{ $themeDimmest := eq .Theme "dark" | ternary (lightness 0.2 $c) (lightness 0.85 $c) | color2css }} + {{/* In the 2024 redesign, these were all forced to use the dark theme variants. */}} + {{ $themeDim := lightness 0.35 $c | color2css }} + {{ $themeDimmer := lightness 0.3 $c | color2css }} + {{ $themeDimmest := lightness 0.2 $c | color2css }} - {{ $themeDark := eq .Theme "dark" | ternary (lightness 0.30 $c) (lightness 0.35 $c) | color2css }} + {{ $themeDark := lightness 0.30 $c | color2css }} - {{ $linkColor := eq .Theme "dark" | ternary (lightness 0.55 $c) (lightness 0.35 $c) | color2css }} - {{ $linkHoverColor := eq .Theme "dark" | ternary (lightness 0.65 $c) (lightness 0.45 $c) | color2css }} + {{ $linkColor := lightness 0.55 $c | color2css }} + {{ $linkHoverColor := lightness 0.65 $c | color2css }} :root { --content-background: #f8f8f8; diff --git a/src/templates/src/layouts/wheeljam_2022_base.html b/src/templates/src/layouts/wheeljam_2022_base.html index b55c2549..42ca4beb 100644 --- a/src/templates/src/layouts/wheeljam_2022_base.html +++ b/src/templates/src/layouts/wheeljam_2022_base.html @@ -37,14 +37,15 @@ /* Copy-paste from project.css yay */ {{ $c := hex2color "346ba6" }} - {{ $themeDim := eq .Theme "dark" | ternary (lightness 0.35 $c) (lightness 0.75 $c) | color2css }} - {{ $themeDimmer := eq .Theme "dark" | ternary (lightness 0.3 $c) (lightness 0.8 $c) | color2css }} - {{ $themeDimmest := eq .Theme "dark" | ternary (lightness 0.2 $c) (lightness 0.85 $c) | color2css }} + {{/* In the 2024 redesign, these were all forced to use the dark theme variants. */}} + {{ $themeDim := lightness 0.35 $c | color2css }} + {{ $themeDimmer := lightness 0.3 $c | color2css }} + {{ $themeDimmest := lightness 0.2 $c | color2css }} - {{ $themeDark := eq .Theme "dark" | ternary (lightness 0.30 $c) (lightness 0.35 $c) | color2css }} + {{ $themeDark := lightness 0.30 $c | color2css }} - {{ $linkColor := eq .Theme "dark" | ternary (lightness 0.55 $c) (lightness 0.35 $c) | color2css }} - {{ $linkHoverColor := eq .Theme "dark" | ternary (lightness 0.65 $c) (lightness 0.45 $c) | color2css }} + {{ $linkColor := lightness 0.55 $c | color2css }} + {{ $linkHoverColor := lightness 0.65 $c | color2css }} :root { --content-background: #f8f8f8; diff --git a/src/templates/src/layouts/wheeljam_2023_base.html b/src/templates/src/layouts/wheeljam_2023_base.html index 38665806..38274787 100644 --- a/src/templates/src/layouts/wheeljam_2023_base.html +++ b/src/templates/src/layouts/wheeljam_2023_base.html @@ -38,14 +38,15 @@ {{/* {{ $c := hex2color "23CE76" }} */}} {{ $c := hex2color "1DB768" }}{{/* modified for contrast reasons */}} - {{ $themeDim := eq .Theme "dark" | ternary (lightness 0.35 $c) (lightness 0.75 $c) | color2css }} - {{ $themeDimmer := eq .Theme "dark" | ternary (lightness 0.3 $c) (lightness 0.8 $c) | color2css }} - {{ $themeDimmest := eq .Theme "dark" | ternary (lightness 0.2 $c) (lightness 0.85 $c) | color2css }} + {{/* In the 2024 redesign, these were all forced to use the dark theme variants. */}} + {{ $themeDim := lightness 0.35 $c | color2css }} + {{ $themeDimmer := lightness 0.3 $c | color2css }} + {{ $themeDimmest := lightness 0.2 $c | color2css }} - {{ $themeDark := eq .Theme "dark" | ternary (lightness 0.30 $c) (lightness 0.35 $c) | color2css }} + {{ $themeDark := lightness 0.30 $c | color2css }} - {{ $linkColor := eq .Theme "dark" | ternary (lightness 0.55 $c) (lightness 0.35 $c) | color2css }} - {{ $linkHoverColor := eq .Theme "dark" | ternary (lightness 0.65 $c) (lightness 0.45 $c) | color2css }} + {{ $linkColor := lightness 0.55 $c | color2css }} + {{ $linkHoverColor := lightness 0.65 $c | color2css }} :root { --content-background: #f8f8f8; diff --git a/src/templates/src/user_settings.html b/src/templates/src/user_settings.html index e8deae12..f9c073f7 100644 --- a/src/templates/src/user_settings.html +++ b/src/templates/src/user_settings.html @@ -33,13 +33,6 @@ -
-
Theme:
-
- - -
-
Avatar:
@@ -52,7 +45,6 @@ document.querySelector("#user_form"), avatarMaxFileSize, document.querySelector(".user_avatar"), - {{ .DefaultAvatarUrl }} );
diff --git a/src/templates/types.go b/src/templates/types.go index badf4542..bc85aad0 100644 --- a/src/templates/types.go +++ b/src/templates/types.go @@ -10,7 +10,6 @@ type BaseData struct { CanonicalLink string OpenGraphItems []OpenGraphItem BackgroundImage BackgroundImage - Theme string BodyClasses []string Breadcrumbs []Breadcrumb Notices []Notice @@ -205,7 +204,6 @@ type User struct { AvatarUrl string ProfileUrl string - DarkTheme bool ShowEmail bool Timezone string diff --git a/src/website/admin.go b/src/website/admin.go index 918350e8..0d7c2c81 100644 --- a/src/website/admin.go +++ b/src/website/admin.go @@ -83,7 +83,6 @@ func AdminAtomFeed(c *RequestContext) ResponseData { &post.Author, false, true, - c.Theme, ) postItem.PostTypePrefix = fmt.Sprintf("ADMIN::UNAPPROVED: %s", postItem.PostTypePrefix) @@ -177,7 +176,7 @@ func AdminApprovalQueue(c *RequestContext) ResponseData { userData = unapprovedUsers[idx] } else { userData = &unapprovedUserData{ - User: templates.UserToTemplate(s.Owner, c.Theme), + User: templates.UserToTemplate(s.Owner), UserLinks: make([]templates.Link, 0, 10), } unapprovedUsers = append(unapprovedUsers, userData) @@ -187,7 +186,7 @@ func AdminApprovalQueue(c *RequestContext) ResponseData { if s.Snippet.When.After(userData.Date) { userData.Date = s.Snippet.When } - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) timelineItem.OwnerAvatarUrl = "" timelineItem.SmallInfo = true userData.Timeline = append(userData.Timeline, timelineItem) @@ -199,7 +198,7 @@ func AdminApprovalQueue(c *RequestContext) ResponseData { userData = unapprovedUsers[idx] } else { userData = &unapprovedUserData{ - User: templates.UserToTemplate(&p.Author, c.Theme), + User: templates.UserToTemplate(&p.Author), UserLinks: make([]templates.Link, 0, 10), } unapprovedUsers = append(unapprovedUsers, userData) @@ -209,7 +208,7 @@ func AdminApprovalQueue(c *RequestContext) ResponseData { if p.Post.PostDate.After(userData.Date) { userData.Date = p.Post.PostDate } - timelineItem := PostToTimelineItem(hmndata.UrlContextForProject(&p.Project), lineageBuilder, &p.Post, &p.Thread, &p.Author, c.Theme) + timelineItem := PostToTimelineItem(hmndata.UrlContextForProject(&p.Project), lineageBuilder, &p.Post, &p.Thread, &p.Author) timelineItem.OwnerAvatarUrl = "" timelineItem.SmallInfo = true timelineItem.Description = template.HTML(p.CurrentVersion.TextParsed) @@ -222,7 +221,7 @@ func AdminApprovalQueue(c *RequestContext) ResponseData { userData = unapprovedUsers[idx] } else { userData = &unapprovedUserData{ - User: templates.UserToTemplate(p.User, c.Theme), + User: templates.UserToTemplate(p.User), UserLinks: make([]templates.Link, 0, 10), } unapprovedUsers = append(unapprovedUsers, userData) @@ -237,7 +236,7 @@ func AdminApprovalQueue(c *RequestContext) ResponseData { userData.Date = p.ProjectAndStuff.Project.DateCreated } userData.ProjectsWithLinks = append(userData.ProjectsWithLinks, projectWithLinks{ - Project: templates.ProjectAndStuffToTemplate(p.ProjectAndStuff, hmndata.UrlContextForProject(&p.ProjectAndStuff.Project).BuildHomepage(), c.Theme), + Project: templates.ProjectAndStuffToTemplate(p.ProjectAndStuff, hmndata.UrlContextForProject(&p.ProjectAndStuff.Project).BuildHomepage()), Links: projectLinks, }) } diff --git a/src/website/base_data.go b/src/website/base_data.go index c3f13168..4b5f1e38 100644 --- a/src/website/base_data.go +++ b/src/website/base_data.go @@ -24,7 +24,7 @@ func getBaseData(c *RequestContext, title string, breadcrumbs []templates.Breadc var templateUser *templates.User var templateSession *templates.Session if c.CurrentUser != nil { - u := templates.UserToTemplate(c.CurrentUser, c.Theme) + u := templates.UserToTemplate(c.CurrentUser) s := templates.SessionToTemplate(c.CurrentSession) templateUser = &u templateSession = &s @@ -44,7 +44,6 @@ func getBaseData(c *RequestContext, title string, breadcrumbs []templates.Breadc } baseData := templates.BaseData{ - Theme: c.Theme, Title: title, Breadcrumbs: breadcrumbs, diff --git a/src/website/blogs.go b/src/website/blogs.go index 9b18a39e..03695357 100644 --- a/src/website/blogs.go +++ b/src/website/blogs.go @@ -67,7 +67,7 @@ func BlogIndex(c *RequestContext) ResponseData { entries = append(entries, blogIndexEntry{ Title: thread.Thread.Title, Url: c.UrlContext.BuildBlogThread(thread.Thread.ID, thread.Thread.Title), - Author: templates.UserToTemplate(thread.FirstPostAuthor, c.Theme), + Author: templates.UserToTemplate(thread.FirstPostAuthor), Date: thread.FirstPost.PostDate, Content: template.HTML(thread.FirstPostCurrentVersion.TextParsed), }) @@ -140,12 +140,12 @@ func BlogThread(c *RequestContext) ResponseData { var templatePosts []templates.Post for _, p := range posts { - post := templates.PostToTemplate(&p.Post, p.Author, c.Theme) + post := templates.PostToTemplate(&p.Post, p.Author) post.AddContentVersion(p.CurrentVersion, p.Editor) addBlogUrlsToPost(c.UrlContext, &post, &p.Thread, p.Post.ID) if p.ReplyPost != nil { - reply := templates.PostToTemplate(p.ReplyPost, p.ReplyAuthor, c.Theme) + reply := templates.PostToTemplate(p.ReplyPost, p.ReplyAuthor) addBlogUrlsToPost(c.UrlContext, &reply, &p.Thread, p.Post.ID) post.ReplyPost = &reply } @@ -403,7 +403,7 @@ func BlogPostReply(c *RequestContext) ResponseData { BlogThreadBreadcrumbs(c.UrlContext, &post.Thread), ) - replyPost := templates.PostToTemplate(&post.Post, post.Author, c.Theme) + replyPost := templates.PostToTemplate(&post.Post, post.Author) replyPost.AddContentVersion(post.CurrentVersion, post.Editor) editData := getEditorDataForNew(c.UrlContext, c.CurrentUser, baseData, &replyPost) @@ -479,7 +479,7 @@ func BlogPostDelete(c *RequestContext) ResponseData { BlogThreadBreadcrumbs(c.UrlContext, &post.Thread), ) - templatePost := templates.PostToTemplate(&post.Post, post.Author, c.Theme) + templatePost := templates.PostToTemplate(&post.Post, post.Author) templatePost.AddContentVersion(post.CurrentVersion, post.Editor) type blogPostDeleteData struct { diff --git a/src/website/common.go b/src/website/common.go index b37914fb..7c954f0f 100644 --- a/src/website/common.go +++ b/src/website/common.go @@ -49,7 +49,7 @@ func loadCommonData(h Handler) Handler { }) if err == nil { c.CurrentProject = &dbProject.Project - c.CurrentProjectLogoUrl = templates.ProjectLogoUrl(&dbProject.Project, dbProject.LogoLightAsset, dbProject.LogoDarkAsset, c.Theme) + c.CurrentProjectLogoUrl = templates.ProjectLogoUrl(&dbProject.Project, dbProject.LogoLightAsset, dbProject.LogoDarkAsset) owners = dbProject.Owners } else { if errors.Is(err, db.NotFound) { @@ -69,7 +69,7 @@ func loadCommonData(h Handler) Handler { panic(oops.New(err, "failed to fetch HMN project")) } c.CurrentProject = &dbProject.Project - c.CurrentProjectLogoUrl = templates.ProjectLogoUrl(&dbProject.Project, dbProject.LogoLightAsset, dbProject.LogoDarkAsset, c.Theme) + c.CurrentProjectLogoUrl = templates.ProjectLogoUrl(&dbProject.Project, dbProject.LogoLightAsset, dbProject.LogoDarkAsset) } if c.CurrentProject == nil { @@ -80,11 +80,6 @@ func loadCommonData(h Handler) Handler { c.UrlContext = hmndata.UrlContextForProject(c.CurrentProject) } - - c.Theme = "light" - if c.CurrentUser != nil && c.CurrentUser.DarkTheme { - c.Theme = "dark" - } } c.Perf.EndBlock() diff --git a/src/website/feed.go b/src/website/feed.go index 07186554..d4ab9203 100644 --- a/src/website/feed.go +++ b/src/website/feed.go @@ -168,7 +168,7 @@ func AtomFeed(c *RequestContext) ResponseData { templateProject := templates.ProjectToTemplate(&p.Project, hmndata.UrlContextForProject(&p.Project).BuildHomepage()) templateProject.UUID = uuid.NewSHA1(uuid.NameSpaceURL, []byte(templateProject.Url)).URN() for _, owner := range p.Owners { - templateProject.Owners = append(templateProject.Owners, templates.UserToTemplate(owner, "")) + templateProject.Owners = append(templateProject.Owners, templates.UserToTemplate(owner)) } feedData.Projects = append(feedData.Projects, templateProject) @@ -216,7 +216,6 @@ func fetchAllPosts(c *RequestContext, offset int, limit int) ([]templates.PostLi postAndStuff.Author, postAndStuff.Unread, true, - c.Theme, ) postItem.UUID = uuid.NewSHA1(uuid.NameSpaceURL, []byte(postItem.Url)).URN() diff --git a/src/website/following.go b/src/website/following.go index 7f7d5ca5..4d7ce870 100644 --- a/src/website/following.go +++ b/src/website/following.go @@ -10,7 +10,7 @@ import ( ) func FollowingTest(c *RequestContext) ResponseData { - timelineItems, err := FetchFollowTimelineForUser(c, c.Conn, c.CurrentUser, c.Theme) + timelineItems, err := FetchFollowTimelineForUser(c, c.Conn, c.CurrentUser) if err != nil { return c.ErrorResponse(http.StatusInternalServerError, err) } diff --git a/src/website/forums.go b/src/website/forums.go index 14904a15..1d46d285 100644 --- a/src/website/forums.go +++ b/src/website/forums.go @@ -124,9 +124,9 @@ func Forum(c *RequestContext) ResponseData { return templates.ThreadListItem{ Title: row.Thread.Title, Url: c.UrlContext.BuildForumThread(cd.LineageBuilder.GetSubforumLineageSlugs(*row.Thread.SubforumID), row.Thread.ID, row.Thread.Title, 1), - FirstUser: templates.UserToTemplate(row.FirstPostAuthor, c.Theme), + FirstUser: templates.UserToTemplate(row.FirstPostAuthor), FirstDate: row.FirstPost.PostDate, - LastUser: templates.UserToTemplate(row.LastPostAuthor, c.Theme), + LastUser: templates.UserToTemplate(row.LastPostAuthor), LastDate: row.LastPost.PostDate, Unread: row.Unread, } @@ -391,12 +391,12 @@ func ForumThread(c *RequestContext) ResponseData { var posts []templates.Post for _, p := range postsAndStuff { - post := templates.PostToTemplate(&p.Post, p.Author, c.Theme) + post := templates.PostToTemplate(&p.Post, p.Author) post.AddContentVersion(p.CurrentVersion, p.Editor) addForumUrlsToPost(c.UrlContext, &post, currentSubforumSlugs, thread.ID, post.ID) if p.ReplyPost != nil { - reply := templates.PostToTemplate(p.ReplyPost, p.ReplyAuthor, c.Theme) + reply := templates.PostToTemplate(p.ReplyPost, p.ReplyAuthor) addForumUrlsToPost(c.UrlContext, &reply, currentSubforumSlugs, thread.ID, reply.ID) post.ReplyPost = &reply } @@ -587,7 +587,7 @@ func ForumPostReply(c *RequestContext) ResponseData { ForumThreadBreadcrumbs(c.UrlContext, cd.LineageBuilder, &post.Thread), ) - replyPost := templates.PostToTemplate(&post.Post, post.Author, c.Theme) + replyPost := templates.PostToTemplate(&post.Post, post.Author) replyPost.AddContentVersion(post.CurrentVersion, post.Editor) editData := getEditorDataForNew(c.UrlContext, c.CurrentUser, baseData, &replyPost) @@ -779,7 +779,7 @@ func ForumPostDelete(c *RequestContext) ResponseData { ForumThreadBreadcrumbs(c.UrlContext, cd.LineageBuilder, &post.Thread), ) - templatePost := templates.PostToTemplate(&post.Post, post.Author, c.Theme) + templatePost := templates.PostToTemplate(&post.Post, post.Author) templatePost.AddContentVersion(post.CurrentVersion, post.Editor) type forumPostDeleteData struct { diff --git a/src/website/jam.go b/src/website/jam.go index 75c3a809..b0f1e580 100644 --- a/src/website/jam.go +++ b/src/website/jam.go @@ -57,7 +57,7 @@ func JamSaveTheDate(c *RequestContext) ResponseData { tmpl := TemplateData{ BaseData: getBaseDataAutocrumb(c, "Upcoming Jams"), - UserAvatarUrl: templates.UserAvatarUrl(c.CurrentUser, "dark"), + UserAvatarUrl: templates.UserAvatarUrl(c.CurrentUser), JamsUrl: hmnurl.BuildJamsIndex(), Visibility2023Url: hmnurl.BuildJamIndex2023_Visibility(), WRJ2023Url: hmnurl.BuildJamIndex2023(), @@ -221,7 +221,7 @@ func getLJ2024BaseData(c *RequestContext) (JamBaseDataLJ2024, error) { } if c.CurrentUser != nil { - tmpl.UserAvatarUrl = templates.UserAvatarUrl(c.CurrentUser, "dark") + tmpl.UserAvatarUrl = templates.UserAvatarUrl(c.CurrentUser) projects, err := hmndata.FetchProjects(c, c.Conn, c.CurrentUser, hmndata.ProjectsQuery{ OwnerIDs: []int{c.CurrentUser.ID}, JamSlugs: []string{hmndata.LJ2024.Slug}, @@ -252,7 +252,7 @@ func getLJ2024FeedData(c *RequestContext, maxTimelineItems int) (JamFeedDataLJ20 for _, jp := range jamProjects { urlContext := hmndata.UrlContextForProject(&jp.Project) projectUrl := urlContext.BuildHomepage() - projects = append(projects, templates.ProjectAndStuffToTemplate(&jp, projectUrl, c.Theme)) + projects = append(projects, templates.ProjectAndStuffToTemplate(&jp, projectUrl)) } projectIds := make([]int, 0, len(jamProjects)) @@ -272,7 +272,7 @@ func getLJ2024FeedData(c *RequestContext, maxTimelineItems int) (JamFeedDataLJ20 timelineItems = make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) timelineItem.SmallInfo = true timelineItems = append(timelineItems, timelineItem) } @@ -367,7 +367,7 @@ func JamIndex2023(c *RequestContext) ResponseData { pageProjects := make([]templates.Project, 0, len(jamProjects)) for _, p := range jamProjects { - pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage())) } projectIds := make([]int, 0, len(jamProjects)) @@ -385,7 +385,7 @@ func JamIndex2023(c *RequestContext) ResponseData { } showcaseItems = make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) if timelineItem.CanShowcase { showcaseItems = append(showcaseItems, timelineItem) } @@ -452,7 +452,7 @@ func JamFeed2023(c *RequestContext) ResponseData { timelineItems = make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) timelineItem.SmallInfo = true timelineItems = append(timelineItems, timelineItem) } @@ -460,7 +460,7 @@ func JamFeed2023(c *RequestContext) ResponseData { pageProjects := make([]templates.Project, 0, len(jamProjects)) for _, p := range jamProjects { - pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage())) } type JamFeedData struct { @@ -553,7 +553,7 @@ func JamIndex2023_Visibility(c *RequestContext) ResponseData { pageProjects := make([]templates.Project, 0, len(jamProjects)) for _, p := range jamProjects { - pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage())) } projectIds := make([]int, 0, len(jamProjects)) @@ -571,7 +571,7 @@ func JamIndex2023_Visibility(c *RequestContext) ResponseData { } showcaseItems = make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) if timelineItem.CanShowcase { showcaseItems = append(showcaseItems, timelineItem) } @@ -620,7 +620,7 @@ func JamFeed2023_Visibility(c *RequestContext) ResponseData { timelineItems = make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) timelineItem.SmallInfo = true timelineItems = append(timelineItems, timelineItem) } @@ -628,7 +628,7 @@ func JamFeed2023_Visibility(c *RequestContext) ResponseData { pageProjects := make([]templates.Project, 0, len(jamProjects)) for _, p := range jamProjects { - pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage())) } type JamFeedData struct { @@ -681,7 +681,7 @@ func JamRecap2023_Visibility(c *RequestContext) ResponseData { var ben templates.User benUser, err := hmndata.FetchUserByUsername(c, c.Conn, c.CurrentUser, "bvisness", hmndata.UsersQuery{}) if err == nil { - ben = templates.UserToTemplate(benUser, c.Theme) + ben = templates.UserToTemplate(benUser) } else if err == db.NotFound { ben = templates.UnknownUser } else { @@ -767,7 +767,7 @@ func JamIndex2022(c *RequestContext) ResponseData { pageProjects := make([]templates.Project, 0, len(jamProjects)) for _, p := range jamProjects { - pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage())) } projectIds := make([]int, 0, len(jamProjects)) @@ -785,7 +785,7 @@ func JamIndex2022(c *RequestContext) ResponseData { } showcaseItems = make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) if timelineItem.CanShowcase { showcaseItems = append(showcaseItems, timelineItem) } @@ -833,7 +833,7 @@ func JamFeed2022(c *RequestContext) ResponseData { timelineItems = make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) timelineItem.SmallInfo = true timelineItems = append(timelineItems, timelineItem) } @@ -841,7 +841,7 @@ func JamFeed2022(c *RequestContext) ResponseData { pageProjects := make([]templates.Project, 0, len(jamProjects)) for _, p := range jamProjects { - pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + pageProjects = append(pageProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage())) } type JamFeedData struct { @@ -901,7 +901,7 @@ func JamIndex2021(c *RequestContext) ResponseData { } showcaseItems := make([]templates.TimelineItem, 0, len(snippets)) for _, s := range snippets { - timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, false) + timelineItem := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, false) if timelineItem.CanShowcase { showcaseItems = append(showcaseItems, timelineItem) } diff --git a/src/website/landing.go b/src/website/landing.go index bcd273b3..d2ebda90 100644 --- a/src/website/landing.go +++ b/src/website/landing.go @@ -40,6 +40,8 @@ func Index(c *RequestContext) ResponseData { var timelineItems []templates.TimelineItem + FetchFollowTimelineForUser(c, c.Conn, c.CurrentUser) + // This is essentially an alternate for feed page 1. posts, err := hmndata.FetchPosts(c, c.Conn, c.CurrentUser, hmndata.PostsQuery{ ThreadTypes: feedThreadTypes, @@ -54,7 +56,7 @@ func Index(c *RequestContext) ResponseData { continue // ignore news posts et. al. } - item := PostToTimelineItem(hmndata.UrlContextForProject(&p.Project), lineageBuilder, &p.Post, &p.Thread, p.Author, c.Theme) + item := PostToTimelineItem(hmndata.UrlContextForProject(&p.Project), lineageBuilder, &p.Post, &p.Thread, p.Author) if p.Thread.Type == models.ThreadTypeProjectBlogPost && p.Post.ID == p.Thread.FirstID { // blog post item.Description = template.HTML(p.CurrentVersion.TextParsed) @@ -75,7 +77,7 @@ func Index(c *RequestContext) ResponseData { var newsPostItem *templates.TimelineItem if len(newsThreads) > 0 { t := newsThreads[0] - item := PostToTimelineItem(hmndata.UrlContextForProject(&t.Project), lineageBuilder, &t.FirstPost, &t.Thread, t.FirstPostAuthor, c.Theme) + item := PostToTimelineItem(hmndata.UrlContextForProject(&t.Project), lineageBuilder, &t.FirstPost, &t.Thread, t.FirstPostAuthor) item.Breadcrumbs = nil item.TypeTitle = "" item.AllowTitleWrap = true diff --git a/src/website/post_helper.go b/src/website/post_helper.go index 33931ec0..6afe4ee0 100644 --- a/src/website/post_helper.go +++ b/src/website/post_helper.go @@ -85,14 +85,13 @@ func MakePostListItem( user *models.User, unread bool, includeBreadcrumbs bool, - currentTheme string, ) templates.PostListItem { var result templates.PostListItem urlContext := hmndata.UrlContextForProject(project) result.Title = thread.Title - result.User = templates.UserToTemplate(user, currentTheme) + result.User = templates.UserToTemplate(user) result.Date = post.PostDate result.Unread = unread result.Url = UrlForGenericPost(urlContext, thread, post, lineageBuilder) diff --git a/src/website/projects.go b/src/website/projects.go index 05669d58..5b50dfa5 100644 --- a/src/website/projects.go +++ b/src/website/projects.go @@ -238,7 +238,7 @@ func getShuffledOfficialProjects(c *RequestContext) ([]templates.Project, error) var restProjects []templates.Project now := time.Now() for _, p := range official { - templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme) + templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage()) if p.Project.Slug == "hero" { // NOTE(asaf): Handmade Hero gets special treatment. Must always be first in the list. @@ -297,7 +297,7 @@ func getPersonalProjects(c *RequestContext, jamSlug string) ([]templates.Project var personalProjects []templates.Project for _, p := range projects { - templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme) + templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage()) personalProjects = append(personalProjects, templateProject) } @@ -410,9 +410,9 @@ func ProjectHomepage(c *RequestContext) ResponseData { if err != nil { return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch project details")) } - templateData.Project = templates.ProjectAndStuffToTemplate(&p, c.UrlContext.BuildHomepage(), c.Theme) + templateData.Project = templates.ProjectAndStuffToTemplate(&p, c.UrlContext.BuildHomepage()) for _, owner := range owners { - templateData.Owners = append(templateData.Owners, templates.UserToTemplate(owner, c.Theme)) + templateData.Owners = append(templateData.Owners, templates.UserToTemplate(owner)) } if c.CurrentProject.Hidden { @@ -467,7 +467,7 @@ func ProjectHomepage(c *RequestContext) ResponseData { } } - templateData.RecentActivity, err = FetchTimeline(c, c.Conn, c.CurrentUser, c.Theme, TimelineQuery{ + templateData.RecentActivity, err = FetchTimeline(c, c.Conn, c.CurrentUser, TimelineQuery{ ProjectIDs: []int{c.CurrentProject.ID}, }) if err != nil { @@ -486,12 +486,12 @@ func ProjectHomepage(c *RequestContext) ResponseData { return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch user projects")) } templateProjects := make([]templates.Project, 0, len(userProjects)) - templateProjects = append(templateProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme)) + templateProjects = append(templateProjects, templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage())) for _, p := range userProjects { if p.Project.ID == c.CurrentProject.ID { continue } - templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme) + templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage()) templateProjects = append(templateProjects, templateProject) } templateData.SnippetEdit = templates.SnippetEdit{ @@ -550,7 +550,7 @@ func ProjectNew(c *RequestContext) ResponseData { } var project templates.ProjectSettings - project.Owners = append(project.Owners, templates.UserToTemplate(c.CurrentUser, c.Theme)) + project.Owners = append(project.Owners, templates.UserToTemplate(c.CurrentUser)) project.Personal = true var currentJam *hmndata.Jam @@ -696,7 +696,6 @@ func ProjectEdit(c *RequestContext) ResponseData { p.Owners, p.TagText(), p.LogoLightAsset, p.LogoDarkAsset, p.HeaderImage, - c.Theme, ) projectSettings.LinksJSON = string(utils.Must1(json.Marshal(templates.LinksToTemplate(projectLinks)))) diff --git a/src/website/requesthandling.go b/src/website/requesthandling.go index 02a74820..f6a8a36a 100644 --- a/src/website/requesthandling.go +++ b/src/website/requesthandling.go @@ -190,7 +190,6 @@ type RequestContext struct { CurrentProjectLogoUrl string CurrentUser *models.User CurrentSession *models.Session - Theme string UrlContext *hmnurl.UrlContext CurrentUserCanEditCurrentProject bool diff --git a/src/website/snippet.go b/src/website/snippet.go index 45caf44b..3aa8116c 100644 --- a/src/website/snippet.go +++ b/src/website/snippet.go @@ -57,7 +57,7 @@ func Snippet(c *RequestContext) ResponseData { c.Perf.EndBlock() canEdit := (c.CurrentUser != nil && (c.CurrentUser.IsStaff || c.CurrentUser.ID == s.Owner.ID)) - snippet := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, c.Theme, canEdit) + snippet := SnippetToTimelineItem(&s.Snippet, s.Asset, s.DiscordMessage, s.Projects, s.Owner, canEdit) snippet.SmallInfo = true opengraph := []templates.OpenGraphItem{ @@ -114,7 +114,7 @@ func Snippet(c *RequestContext) ResponseData { } templateProjects := make([]templates.Project, 0, len(userProjects)) for _, p := range userProjects { - templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme) + templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage()) templateProjects = append(templateProjects, templateProject) } snippetEdit = templates.SnippetEdit{ diff --git a/src/website/timeline_helper.go b/src/website/timeline_helper.go index 687b6274..2fffc45f 100644 --- a/src/website/timeline_helper.go +++ b/src/website/timeline_helper.go @@ -20,7 +20,7 @@ import ( "git.handmade.network/hmn/hmn/src/templates" ) -func FetchFollowTimelineForUser(ctx context.Context, conn db.ConnOrTx, user *models.User, theme string) ([]templates.TimelineItem, error) { +func FetchFollowTimelineForUser(ctx context.Context, conn db.ConnOrTx, user *models.User) ([]templates.TimelineItem, error) { perf := perf.ExtractPerf(ctx) type Follower struct { UserID int `db:"user_id"` @@ -50,7 +50,7 @@ func FetchFollowTimelineForUser(ctx context.Context, conn db.ConnOrTx, user *mod } } - timelineItems, err := FetchTimeline(ctx, conn, user, theme, TimelineQuery{ + timelineItems, err := FetchTimeline(ctx, conn, user, TimelineQuery{ UserIDs: userIDs, ProjectIDs: projectIDs, }) @@ -64,7 +64,7 @@ type TimelineQuery struct { ProjectIDs []int } -func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.User, theme string, q TimelineQuery) ([]templates.TimelineItem, error) { +func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.User, q TimelineQuery) ([]templates.TimelineItem, error) { perf := perf.ExtractPerf(ctx) var users []*models.User var projects []hmndata.ProjectAndStuff @@ -159,7 +159,6 @@ func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.Us &post.Post, &post.Thread, post.Author, - theme, )) } } @@ -171,7 +170,6 @@ func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.Us s.DiscordMessage, s.Projects, s.Owner, - theme, false, ) item.SmallInfo = true @@ -188,7 +186,7 @@ func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.Us if streamer.UserID != nil { for _, u := range users { if u.ID == *streamer.UserID { - ownerAvatarUrl = templates.UserAvatarUrl(u, theme) + ownerAvatarUrl = templates.UserAvatarUrl(u) ownerName = u.BestName() ownerUrl = hmnurl.BuildUserProfile(u.Username) break @@ -197,7 +195,7 @@ func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.Us } else if streamer.ProjectID != nil { for _, p := range projects { if p.Project.ID == *streamer.ProjectID { - ownerAvatarUrl = templates.ProjectLogoUrl(&p.Project, p.LogoLightAsset, p.LogoDarkAsset, theme) + ownerAvatarUrl = templates.ProjectLogoUrl(&p.Project, p.LogoLightAsset, p.LogoDarkAsset) ownerName = p.Project.Name ownerUrl = hmndata.UrlContextForProject(&p.Project).BuildHomepage() } @@ -207,9 +205,6 @@ func FetchTimeline(ctx context.Context, conn db.ConnOrTx, currentUser *models.Us break } } - if ownerAvatarUrl == "" { - ownerAvatarUrl = templates.UserAvatarDefaultUrl(theme) - } item := TwitchStreamToTimelineItem(s, ownerAvatarUrl, ownerName, ownerUrl) timelineItems = append(timelineItems, item) } @@ -241,7 +236,6 @@ func PostToTimelineItem( post *models.Post, thread *models.Thread, owner *models.User, - currentTheme string, ) templates.TimelineItem { item := templates.TimelineItem{ Date: post.PostDate, @@ -249,7 +243,7 @@ func PostToTimelineItem( Breadcrumbs: GenericThreadBreadcrumbs(urlContext, lineageBuilder, thread), Url: UrlForGenericPost(urlContext, thread, post, lineageBuilder), - OwnerAvatarUrl: templates.UserAvatarUrl(owner, currentTheme), + OwnerAvatarUrl: templates.UserAvatarUrl(owner), OwnerName: owner.BestName(), OwnerUrl: hmnurl.BuildUserProfile(owner.Username), } @@ -313,7 +307,6 @@ func SnippetToTimelineItem( discordMessage *models.DiscordMessage, projects []*hmndata.ProjectAndStuff, owner *models.User, - currentTheme string, editable bool, ) templates.TimelineItem { item := templates.TimelineItem{ @@ -322,7 +315,7 @@ func SnippetToTimelineItem( FilterTitle: "Snippets", Url: hmnurl.BuildSnippet(snippet.ID), - OwnerAvatarUrl: templates.UserAvatarUrl(owner, currentTheme), + OwnerAvatarUrl: templates.UserAvatarUrl(owner), OwnerName: owner.BestName(), OwnerUrl: hmnurl.BuildUserProfile(owner.Username), @@ -366,7 +359,7 @@ func SnippetToTimelineItem( return projects[i].Project.Name < projects[j].Project.Name }) for _, proj := range projects { - item.Projects = append(item.Projects, templates.ProjectAndStuffToTemplate(proj, hmndata.UrlContextForProject(&proj.Project).BuildHomepage(), currentTheme)) + item.Projects = append(item.Projects, templates.ProjectAndStuffToTemplate(proj, hmndata.UrlContextForProject(&proj.Project).BuildHomepage())) } return item diff --git a/src/website/user.go b/src/website/user.go index c23ac708..47f8ebab 100644 --- a/src/website/user.go +++ b/src/website/user.go @@ -106,7 +106,7 @@ func UserProfile(c *RequestContext) ResponseData { templateProjects := make([]templates.Project, 0, len(projectsAndStuff)) numPersonalProjects := 0 for _, p := range projectsAndStuff { - templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage(), c.Theme) + templateProject := templates.ProjectAndStuffToTemplate(&p, hmndata.UrlContextForProject(&p.Project).BuildHomepage()) templateProjects = append(templateProjects, templateProject) if p.Project.Personal { @@ -115,14 +115,14 @@ func UserProfile(c *RequestContext) ResponseData { } c.Perf.EndBlock() - timelineItems, err := FetchTimeline(c, c.Conn, c.CurrentUser, c.Theme, TimelineQuery{ + timelineItems, err := FetchTimeline(c, c.Conn, c.CurrentUser, TimelineQuery{ UserIDs: []int{profileUser.ID}, }) if err != nil { return c.ErrorResponse(http.StatusInternalServerError, err) } - templateUser := templates.UserToTemplate(profileUser, c.Theme) + templateUser := templates.UserToTemplate(profileUser) baseData := getBaseDataAutocrumb(c, templateUser.Name) @@ -183,7 +183,6 @@ func UserSettings(c *RequestContext) ResponseData { templates.BaseData AvatarMaxFileSize int - DefaultAvatarUrl string User templates.User Avatar *templates.Asset @@ -254,14 +253,13 @@ func UserSettings(c *RequestContext) ResponseData { } } - templateUser := templates.UserToTemplate(c.CurrentUser, c.Theme) + templateUser := templates.UserToTemplate(c.CurrentUser) baseData := getBaseDataAutocrumb(c, templateUser.Name) res.MustWriteTemplate("user_settings.html", UserSettingsTemplateData{ BaseData: baseData, AvatarMaxFileSize: UserAvatarMaxFileSize, - DefaultAvatarUrl: templates.UserAvatarDefaultUrl(c.Theme), User: templateUser, Avatar: templates.AssetToTemplate(c.CurrentUser.AvatarAsset), Email: c.CurrentUser.Email, @@ -319,7 +317,6 @@ func UserSettingsSave(c *RequestContext) ResponseData { } showEmail := form.Get("showemail") != "" - darkTheme := form.Get("darktheme") != "" blurb := form.Get("shortbio") signature := form.Get("signature") @@ -336,7 +333,6 @@ func UserSettingsSave(c *RequestContext) ResponseData { name = $?, email = $?, showemail = $?, - darktheme = $?, blurb = $?, signature = $?, bio = $? @@ -344,7 +340,6 @@ func UserSettingsSave(c *RequestContext) ResponseData { name, email, showEmail, - darkTheme, blurb, signature, bio, diff --git a/todo-styles.md b/todo-styles.md index aa400c72..26c70d1c 100644 --- a/todo-styles.md +++ b/todo-styles.md @@ -53,4 +53,6 @@ - GitHub - Threads? - TikTok? - - Trello? \ No newline at end of file + - Trello? +- [ ] Handle empty avatar URLs correctly in various places (render as theme-dependent default) +- [ ] Resolve TODO(redesign) comments