Repository navigation
Fix #26: let users explain a downvote with a short comment - #35
Open
xiaoyao-666-coder wants to merge 2 commits into
Open
xiaoyao-666-coder wants to merge 2 commits into
xiaoyao-666-coder wants to merge 2 commits into
Conversation
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.
问题
点踩后没有任何文字反馈入口:
sendFeedback请求体只有{session_id, message_id, rating},全文件无 comment 输入框;后端FeedbackRequest.comment早就存在(max_length=500),但 UI 不提供输入途径。点 down 后无法说明哪里不对,反馈对改进回答几乎无信息量。修复
rows=2,打开时自动聚焦)、实时字数x/500 字、“取消”和“提交反馈”两个按钮。点 👍 仍是一键提交,不问文字——issue 只要求 down 有入口,且 up 问文字会打断最常用的正向反馈。{session_id, message_id, rating:"down", comment}一起 POST 到已有的/api/feedback(后端不用改)。文字为空(或全空白)时请求体里直接省略comment字段,与原来无 comment 的点踩行为完全一致。提交前校验长度,超 500 字时 toast 提示并拦截(textarea 本身也有maxLength=500,校验是双保险)。frontend/src/feedback-comment.ts(请求体组装、500 字校验、输入框状态机),组件里用useReducer接管;新会话/退出登录时状态随feedbackSent一起重置。换一条回答开输入框时,上一条的草稿会保留(切回来还在);点“取消”则丢弃草稿。feedbackSent守卫照常拦住再次点击,本分支基于干净 main,没有 [高] 投过票后无法改票/撤销,点另一个按钮静默无反应 #19 的改票接口,也没顺手实现。验证
npm test22 passed(基线 10 + 12 新),npm run build(tsc -b && vite build)正常。新增测试覆盖:请求体含/不含 comment、trim、500 字边界、开框/输入/取消/提交成功/提交失败保留草稿/切换回答保留草稿/reset。MEDGUIDE_MODE=test python -m pytest -q backend/tests521 passed(基线,无后端改动)。已知遗留
Closes #26