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{ var queryableKinds = []reflect.Kind{
reflect.Int, reflect.Int,
reflect.String,
} }
/* /*

View File

@ -69,6 +69,8 @@ type TimelineQuery struct {
SkipSnippets bool SkipSnippets bool
SkipPosts bool SkipPosts bool
IncludePostDescription bool
Limit, Offset int Limit, Offset int
} }
@ -252,6 +254,10 @@ func FetchTimeline(
if results[idx].Owner != nil { if results[idx].Owner != nil {
results[idx].Owner.AvatarAsset = results[idx].AvatarAsset 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 var projectIds []int

View File

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

View File

@ -56,7 +56,9 @@
- TikTok? - TikTok?
- Trello? - Trello?
- [ ] Handle empty avatar URLs correctly in various places (render as theme-dependent default) - [ ] 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 - [ ] Resolve TODO(redesign) comments
stack! stack!