Skip to content

feat: "Most viewed" sort order on the question list - #1623

Open
rstrzelecki-inne-projekty wants to merge 1 commit into
apache:mainfrom
rstrzelecki-inne-projekty:feat/most-viewed-order
Open

rstrzelecki-inne-projekty wants to merge 1 commit into
apache:mainfrom
rstrzelecki-inne-projekty:feat/most-viewed-order

Conversation

@rstrzelecki-inne-projekty

Copy link
Copy Markdown

Proposed Changes

Adds a "Most viewed" sort order (order=views) to the question list, next to Newest / Active / Unanswered / Recommend / Frequent / Score.

  • internal/schema/question_schema.go: new QuestionOrderCondViews = "views", accepted by the order validation of QuestionPageReq and GetQuestionLinkReq.
  • internal/repo/question/question_repo.go: ORDER BY question.pin DESC, question.view_count DESC, question.created_at DESC for the question page and the linked-questions page (same places that handle the other orders).
  • UI: 'views' added to QuestionOrderBy and QUESTION_ORDER_KEYS (it lands in the "More" dropdown like Frequent / Score, and is promoted to a button when selected); label question.views: Most viewed in en_US.yaml.

Why: on a support-style community the questions people actually open most are a useful default for "what should I read first"; view_count is already maintained, so this is just exposing it as a sort.

Tested on a 2.0.2 instance: /questions?order=views returns questions by view count descending (pinned ones first), works on /questions, tag pages and linked questions; tsc / eslint clean, go build ./... ok.

🤖 Generated with Claude Code

https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR

Adds order=views to the question list (and the linked-questions list):
pinned first, then question.view_count DESC, newest first on ties.
UI: new entry in QUESTION_ORDER_KEYS, label question.views.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR
rstrzelecki-inne-projekty pushed a commit to rstrzelecki-inne-projekty/answer that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants