feat: "Most viewed" sort order on the question list - #1623
Open
rstrzelecki-inne-projekty wants to merge 1 commit into
Open
rstrzelecki-inne-projekty wants to merge 1 commit into
rstrzelecki-inne-projekty wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: newQuestionOrderCondViews = "views", accepted by theordervalidation ofQuestionPageReqandGetQuestionLinkReq.internal/repo/question/question_repo.go:ORDER BY question.pin DESC, question.view_count DESC, question.created_at DESCfor the question page and the linked-questions page (same places that handle the other orders).'views'added toQuestionOrderByandQUESTION_ORDER_KEYS(it lands in the "More" dropdown like Frequent / Score, and is promoted to a button when selected); labelquestion.views: Most viewedinen_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_countis already maintained, so this is just exposing it as a sort.Tested on a 2.0.2 instance:
/questions?order=viewsreturns questions by view count descending (pinned ones first), works on/questions, tag pages and linked questions;tsc/eslintclean,go build ./...ok.🤖 Generated with Claude Code
https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR