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

View File

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

View File

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