65 Commits

Author SHA1 Message Date
LinkinStars c589b59dd5 fix: enhance answer visibility checks for user permissions 2026-07-10 10:19:39 +08:00
LinkinStars a00cb2d38c fix: update goroutine handling and context imports for consistency 2026-07-10 10:19:39 +08:00
LinkinStars b575fe893b Harden avatar cleanup ownership checks 2026-07-10 10:19:39 +08:00
LinkinStars 54b1b35df5 Align revision audit permission checks 2026-07-10 10:19:39 +08:00
Artur Iusupov 3a5a15fe77 fix(site): require explicit email verification setting
Replace OptionalBool with an explicit require_email_verification value for the login settings save request while keeping legacy read defaults intact.

Use positive RequireEmailVerification naming through the registration flow and inline the site setting mapping.

Add validation, save-path, and registration coverage for the explicit email verification setting.
2026-07-10 10:19:39 +08:00
Artur Iusupov 7123326515 feat(site): allow disabling email verification 2026-07-10 10:19:39 +08:00
hgaol 4aa52a6b52 fix: accept answer fails when short links enabled (#1541)
The ownership check added to AcceptAnswer compared the answer's QuestionID
against the request's QuestionID directly. When short links are enabled,
answerRepo.GetByID re-encodes QuestionID to its short form while the
controller de-shorts req.QuestionID to its long form, so the two encodings
of the same question never matched and every accept returned "Answer do not
found". Normalize both ids via uid.DeShortID before comparing, preserving the
privilege-escalation guard for answers that truly belong to another question.
2026-07-10 10:19:39 +08:00
LinkinStars b1da65fbe4 Merge remote-tracking branch 'origin/fix/2.0.1/chat' into test 2026-05-11 12:16:58 +08:00
LinkinStars 11091244f6 fix(user): enhance avatar validation by adding checks for custom avatars and file ownership 2026-05-11 12:05:18 +08:00
LinkinStars 11c80384f1 fix(chat): enhance visibility checks by adding admin moderator support in answer and comment services 2026-05-09 15:13:50 +08:00
hgaol ac7bdda074 fix lint 2026-05-08 19:57:19 +08:00
hgaol 5d923f8ca3 feat: add vector sync service and integrate with answer and question services 2026-05-08 19:57:19 +08:00
LinkinStars 9ea13af860 feat(revision): enhance revision management with object status handling 2026-01-27 17:38:47 +08:00
ferhat elmas 26d868b123 refactor(queue): improve queues
* fix race condition for registering handler
* add close method
* use generics to reduce duplication
* rename packages to drop underscore for go convention
* rename interface to drop stutter with package name

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
2026-01-14 11:22:53 +08:00
liqiang46 61d9bf34d3 修复最佳评论越权问题
在AcceptAnswer方法中添加了安全检查,确保要设置为最佳答案的回答确实属于该问题。
这可以防止攻击者将其他问题的回答设置为当前问题的最佳答案。

安全问题:越权设置最佳评论
修复方法:验证acceptedAnswerInfo.QuestionID == req.QuestionID
2025-12-29 10:24:01 +08:00
ferhat elmas 670aa32325 refactor(lint): add new linters and fix their issues
* gocritic
* misspell
* modernize (aside, bumping go would be nice)
* testifylint
* unconvert
* unparam
* whitespace

related to #1432

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
2025-12-05 10:45:55 +08:00
LinkinStars 5e705a124b refactor(lint): improve error handling and code consistency across multiple files 2025-12-01 12:27:25 +08:00
LinkinStars 9540ef6005 refactor(goimports): add goimports to golangci-lint configuration #1432 2025-12-01 11:32:12 +08:00
LinkinStars fc2a1d8afe fix(answer): update QuestionID handling in answer update process 2025-11-28 17:01:12 +08:00
Dinesht04 9154b9ba5b feat(ui,internal): add optional question body 2025-10-22 18:43:54 +08:00
Dinesht04 403dec5e39 feat(internal,ui): add minimum tags error and label while editing 2025-10-16 09:46:08 +08:00
Dinesht04 9b65fed9f0 refactor(tags): remove redundant param from GetMinimumTags and apply minimum tag check in ObjectChangeTag 2025-10-16 09:46:08 +08:00
Dinesht04 3ae38a14f0 feat(UI): Add error for minimum_tag count and translation for Min tag form input 2025-10-16 09:46:08 +08:00
Dinesht04 a63fe5b26c feat(internal,ui): add minimum tags property 2025-10-16 09:46:08 +08:00
Neko 81837c9fe0 update new question message tag
fix new question message tag to get all question tags
2025-08-28 16:53:53 +08:00
LinkinStars 3b8b5871a6 feat(user): add user status messages and support localization 2025-06-26 16:10:09 +08:00
LinkinStars 550a92684e feat(migrations): move user config to interface 2025-06-26 11:20:23 +08:00
DanielAuerX def0559a55 Fix file record and delete files (branding and avatar) (#1335)
- [x] create file_record table
- [x] avatar and branding files are added to file_record
- [x] branding files are being deleted
- [x] avatar files are being deleted
- [x] reload latest avatar (frontend) after backend state is being
updated

problems addressed in the pr:
- clean up job fails, because it cannot access file_record table
- avatar and branding files are not added to the file_record table
- avatar and branding files are never deleted
- after an avatar is being updated/deleted, the old file is still being
requested due to browser caching. This is causing error logs ("no such
file or directory") in the backend.

cf. conversation in [pr
1326](https://github.com/apache/answer/pull/1326)

---------

Co-authored-by: broccoli <lekker.broccoli@gmail.com>
Co-authored-by: LinkinStars <linkinstar@foxmail.com>
2025-05-23 15:07:14 +08:00
hgaol 3b07b39d89 remove unused service in question service 2025-03-26 18:44:14 +08:00
hgaol 989b2b3650 feat: support using search plugin to search similar question in ask question page 2025-03-26 18:44:14 +08:00
LinkinStars 849ad8dfc5 Merge remote-tracking branch 'origin/dev' into test 2025-03-14 14:17:00 +08:00
sy-records 12275b622f fix: Fix missing QuestionOrderCondFrequent 2025-03-04 10:47:24 +08:00
LinkinStars 5cffab8649 feat(service): implement file cleanup and deletion functionality 2025-01-10 10:43:35 +08:00
LinkinStars 47c666200e Merge remote-tracking branch 'origin/main' into dev
# Conflicts:
#	internal/base/middleware/accept_language.go
#	internal/schema/answer_schema.go
#	internal/schema/comment_schema.go
#	internal/service/user_admin/user_backyard.go
2025-01-07 12:48:13 +08:00
LinkinStars 0618947350 refactor(name): rename incubator-answer 2025-01-07 10:39:23 +08:00
Luffy 0f69467340 feat: remove user config 2025-01-02 16:49:07 +08:00
LinkinStars e7ee4ea91d fix(review): reject the review when delete question 2024-12-09 11:52:18 +08:00
LinkinStars 23cc755aa8 feat(question): add question linking feature for closing question 2024-10-18 15:55:31 +08:00
Sonui 74368ec9d4 perf: optimize question link processing 2024-10-12 10:17:18 +08:00
Sonui b328a2b496 style: use ReplaceAll instead of Replace 2024-10-12 10:17:18 +08:00
Sonui ab920ac0e1 perf: skip link addition for same question id 2024-10-12 10:17:18 +08:00
Sonui 3eb9822c09 feat(question): support linking question 2024-10-12 10:17:18 +08:00
LinkinStars 0d6ea89ad3 refactor(gomod): upgrade golang and dependence version 2024-09-23 15:00:34 +08:00
LinkinStars d5d9f38cb1 feat(badge): add trigger object id for all badge award event 2024-09-04 12:00:36 +08:00
LinkinStars 2ca5e8bb4a Merge branch 'dev' into test
# Conflicts:
#	cmd/wire_gen.go
#	internal/service/content/question_service.go
2024-09-04 10:29:05 +08:00
ferrischi201 eacb79e512 feat(recommend): add tag-based recommendations in question page
Filter out deleted or hidden questions and support multi databases and filter out deleted or hidden questions.

For issue:1003.
2024-09-04 10:24:53 +08:00
LinkinStars 2eaa7dba36 Merge remote-tracking branch 'origin/dev' into feat/1.4.0/badge 2024-09-03 14:16:24 +08:00
alvin 63e1da69a1 refactor: add err handling for activeUser 2024-09-03 10:45:09 +08:00
LinkinStars f0c433cc02 fix(badge): fix badge init data 2024-08-14 12:31:03 +08:00
LinkinStars 07e4f549b1 feat(badge): add event for the badge 2024-08-08 16:19:47 +08:00