Fix timeline bug with deleted users

This commit is contained in:
Ben Visness 2024-06-20 19:29:54 -05:00
parent 5427092708
commit d242c71a2b
3 changed files with 8 additions and 6 deletions

View File

@ -79,7 +79,7 @@
Filters Filters
</div> </div>
</div> </div>
<div> <div class="flex-grow-1">
<div class="flex flex-row items-center mb2"> <div class="flex flex-row items-center mb2">
<h2 id="recent">Recent Activity</h2> <h2 id="recent">Recent Activity</h2>
<div class="flex-grow-1"></div> <div class="flex-grow-1"></div>
@ -91,6 +91,7 @@
{{ range .RecentActivity }} {{ range .RecentActivity }}
{{ template "timeline_item.html" . }} {{ template "timeline_item.html" . }}
{{ end }} {{ end }}
TODO: READ MORE LINK
</div> </div>
</div> </div>
</div> </div>
@ -124,7 +125,6 @@
</div> </div>
</div> </div>
{{ end }} {{ end }}
</div> </div>
</div> </div>
{{ if .User }} {{ if .User }}

View File

@ -334,7 +334,7 @@ type ProjectHomepageData struct {
} }
func ProjectHomepage(c *RequestContext) ResponseData { func ProjectHomepage(c *RequestContext) ResponseData {
maxRecentActivity := 15 maxRecentActivity := 100
if c.CurrentProject == nil { if c.CurrentProject == nil {
return FourOhFour(c) return FourOhFour(c)

View File

@ -243,15 +243,17 @@ func PostToTimelineItem(
thread *models.Thread, thread *models.Thread,
owner *models.User, owner *models.User,
) templates.TimelineItem { ) templates.TimelineItem {
ownerTmpl := templates.UserToTemplate(owner)
item := templates.TimelineItem{ item := templates.TimelineItem{
Date: post.PostDate, Date: post.PostDate,
Title: thread.Title, Title: thread.Title,
Breadcrumbs: GenericThreadBreadcrumbs(urlContext, lineageBuilder, thread), Breadcrumbs: GenericThreadBreadcrumbs(urlContext, lineageBuilder, thread),
Url: UrlForGenericPost(urlContext, thread, post, lineageBuilder), Url: UrlForGenericPost(urlContext, thread, post, lineageBuilder),
OwnerAvatarUrl: templates.UserAvatarUrl(owner), OwnerAvatarUrl: ownerTmpl.AvatarUrl,
OwnerName: owner.BestName(), OwnerName: ownerTmpl.Name,
OwnerUrl: hmnurl.BuildUserProfile(owner.Username), OwnerUrl: ownerTmpl.ProfileUrl,
} }
if typeTitles, ok := TimelineTypeTitleMap[post.ThreadType]; ok { if typeTitles, ok := TimelineTypeTitleMap[post.ThreadType]; ok {