Skip to content

Comment sort — per-thread selector and user preference #31

@PortableProgrammer

Description

@PortableProgrammer

Two coupled additions.

Task 1 — Per-thread sort selector

A sort selector on each comments page allowing the user to re-sort comments (top, best, new, controversial, old, qa) for that thread.

  • Add the selector to src/views/comments.pug — model after the existing sort/view dropdowns in src/views/index.pug:45-72
  • Plumb a sort param through getSubmissionComments(id, params) in src/geddit.js
  • /comments/:id handler at src/routes/index.js:64-97 reads req.query.sort, falls back to user pref, forwards to geddit

Task 2 — User preference for default comment sort

Separate from the feed sort preference, applied automatically when entering any comments page. The per-thread selector overrides for that page only.

  • New DB column pref_commentSort (default confidence — Reddit's "best")
  • Migration in src/db.js
  • Entry in prefToColumn map in src/routes/index.js
  • get_user_prefs helper updated
  • Dashboard selector in src/views/dashboard.pug

Acceptance

Changing comment sort on one thread persists for that thread only via URL param; the user pref controls the default on all threads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions