Skip to content

Commit

Permalink
really fix missing line break between votes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Jan 8, 2024
1 parent 94ecd14 commit af7bcef
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions front/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ func (r *request) PrintNote(w text.Writer, note *ap.Object, author *ap.Actor, gr
}

func (r *request) PrintNotes(w text.Writer, rows data.OrderedMap[string, noteMetadata], printAuthor, printParentAuthor, printDaySeparators bool) {
lastDay := int64(-1)
var lastDay int64
first := true
rows.Range(func(noteString string, meta noteMetadata) bool {
note := ap.Object{}
if err := json.Unmarshal([]byte(noteString), &note); err != nil {
Expand Down Expand Up @@ -413,12 +414,10 @@ func (r *request) PrintNotes(w text.Writer, rows data.OrderedMap[string, noteMet

currentDay := note.Published.Unix() / (60 * 60 * 24)

if lastDay >= 0 {
if !printDaySeparators || currentDay == lastDay {
w.Empty()
} else {
w.Separator()
}
if !first && printDaySeparators && currentDay != lastDay {
w.Separator()
} else if !first {
w.Empty()
}

if meta.Group.Valid {
Expand All @@ -428,6 +427,7 @@ func (r *request) PrintNotes(w text.Writer, rows data.OrderedMap[string, noteMet
}

lastDay = currentDay
first = false
return true
})
}

0 comments on commit af7bcef

Please sign in to comment.