Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 95193fb66d |
@@ -52,11 +52,17 @@ func parseNoteListItem(item *goquery.Selection) *NotePreview {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note ID lives in the href: /msg/pms/{folder}/{id}/#message. Strip the
|
// Note ID lives in the href: /msg/pms/{folder}/{id}/#message. Strip the
|
||||||
// fragment first so extractIntFromHref picks the trailing numeric path.
|
// fragment first, then take the *last* numeric segment — the folder
|
||||||
|
// number (e.g. 1) appears before the note ID and would otherwise win
|
||||||
|
// the "first numeric segment" race in extractIntFromHref.
|
||||||
if i := strings.Index(href, "#"); i != -1 {
|
if i := strings.Index(href, "#"); i != -1 {
|
||||||
href = href[:i]
|
href = href[:i]
|
||||||
}
|
}
|
||||||
np.ID = NoteID(extractIntFromHref(href))
|
for _, seg := range strings.Split(href, "/") {
|
||||||
|
if n, err := parseID[NoteID](seg); err == nil && n != 0 {
|
||||||
|
np.ID = n
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read/unread: classes on the subject link.
|
// Read/unread: classes on the subject link.
|
||||||
if class, _ := subjectLink.Attr("class"); strings.Contains(class, "note-unread") || strings.Contains(class, "unread") && !strings.Contains(class, "note-read") {
|
if class, _ := subjectLink.Attr("class"); strings.Contains(class, "note-unread") || strings.Contains(class, "unread") && !strings.Contains(class, "note-read") {
|
||||||
|
|||||||
Reference in New Issue
Block a user