Skip to content

Commit

Permalink
fix: toggle read (guyfedwards#50)
Browse files Browse the repository at this point in the history
The "Toggle read" functionality marked items as read, but never as
unread.
  • Loading branch information
adamsoderstrom authored Dec 22, 2023
1 parent fdd0d1b commit 0747c13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (sls SQLiteStore) GetAllItems() ([]Item, error) {
}

func (sls SQLiteStore) ToggleRead(ID int) error {
stmt, _ := sls.db.Prepare(`update items set readat = ? where id = ?`)
stmt, _ := sls.db.Prepare(`update items set readat = case when readat is null then ? else null end where id = ?`)

_, err := stmt.Exec(time.Now(), ID)
if err != nil {
Expand Down

0 comments on commit 0747c13

Please sign in to comment.