Remove post descriptions from timelines by default

This commit is contained in:
Ben Visness 2024-06-28 22:53:46 -05:00
parent 9093f38b47
commit 1b97bbb2d9
4 changed files with 22 additions and 11 deletions

View File

@ -479,6 +479,7 @@ This is common for custom types like:
*/
var queryableKinds = []reflect.Kind{
reflect.Int,
reflect.String,
}
/*

View File

@ -69,6 +69,8 @@ type TimelineQuery struct {
SkipSnippets bool
SkipPosts bool
IncludePostDescription bool
Limit, Offset int
}
@ -252,6 +254,10 @@ func FetchTimeline(
if results[idx].Owner != nil {
results[idx].Owner.AvatarAsset = results[idx].AvatarAsset
}
if results[idx].Item.Type == models.TimelineItemTypePost && !q.IncludePostDescription {
results[idx].Item.RawDescription = ""
results[idx].Item.ParsedDescription = ""
}
}
var projectIds []int

View File

@ -6,10 +6,12 @@ import (
"github.com/google/uuid"
)
type TimelineItemType string
const (
TimelineItemTypeSnippet = "snippet"
TimelineItemTypePost = "post"
TimelineItemTypeStream = "stream" // NOTE(asaf): Not currently supported
TimelineItemTypeSnippet TimelineItemType = "snippet"
TimelineItemTypePost TimelineItemType = "post"
TimelineItemTypeStream TimelineItemType = "stream" // NOTE(asaf): Not currently supported
)
// NOTE(asaf): This is a virtual model made up of several different tables
@ -18,7 +20,7 @@ type TimelineItem struct {
// NOTE(asaf): Several different items can have the same ID because we're merging several tables
ID int `db:"id"`
Date time.Time `db:"\"when\""`
Type string `db:"timeline_type"`
Type TimelineItemType `db:"timeline_type"`
OwnerID int `db:"owner_id"`
Title string `db:"title"`
ParsedDescription string `db:"parsed_desc"`

View File

@ -56,7 +56,9 @@
- TikTok?
- Trello?
- [ ] Handle empty avatar URLs correctly in various places (render as theme-dependent default)
- [ ] Convert to new color vars
- [x] Convert to new color vars
- [ ] Make snippet descriptions partially collapse by default
- [ ] Make the home page remember which tab you were on
- [ ] Resolve TODO(redesign) comments
stack!