mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5888] [MERGED] fix(clients): include Telegram ID in client list search #6023
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6023
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5888
Author: @mrnickson-hue
Created: 7/10/2026
Status: ✅ Merged
Merged: 7/10/2026
Merged by: @MHSanaei
Base:
main← Head:fix/client-search-by-tg-id📝 Commits (3)
5f28decfix(clients): include Telegram ID in client list searcha188a47fix(clients): drop explanatory comment, mention Telegram ID in search hintfd92e94test(clients): remove TgID search test per maintainer request📊 Changes
14 files changed (+16 additions, -13 deletions)
View changed files
📝
internal/web/service/client_paging.go(+3 -0)📝
internal/web/translation/ar-EG.json(+1 -1)📝
internal/web/translation/en-US.json(+1 -1)📝
internal/web/translation/es-ES.json(+1 -1)📝
internal/web/translation/fa-IR.json(+1 -1)📝
internal/web/translation/id-ID.json(+1 -1)📝
internal/web/translation/ja-JP.json(+1 -1)📝
internal/web/translation/pt-BR.json(+1 -1)📝
internal/web/translation/ru-RU.json(+1 -1)📝
internal/web/translation/tr-TR.json(+1 -1)📝
internal/web/translation/uk-UA.json(+1 -1)📝
internal/web/translation/vi-VN.json(+1 -1)📝
internal/web/translation/zh-CN.json(+1 -1)📝
internal/web/translation/zh-TW.json(+1 -1)📄 Description
Summary
Fixes #5880 — searching the client list by Telegram user ID no longer matched, because
clientMatchesSearch(internal/web/service/client_paging.go) only checkedEmail, SubID, Comment, UUID, Password, Auth.This is a genuine regression, not a field that simply was never included. Before the paged/search backend endpoint was added in #4500, the frontend searched with
ObjectUtil.deepSearch()over the entire client object, which recursed into every field — includingtgId— since it's just a number that getstoString()'d and substring-matched. Replacing that with a fixed backend candidate list silently dropped Telegram ID from being searchable. SincetgIdis normally populated through the panel's own Telegram bot linking flow rather than typed in manually, being able to look a client up by it in the panel is the actual point of the field.Change
clientMatchesSearchnow also matches onTgID. It'sint64(0 = unset), so it can't sit in the existing[]stringcandidates array — matched separately viastrconv.FormatInt, and skipped when0so a needle of"0"doesn't spuriously match every client without a Telegram ID.client_search_tgid_test.go: full match, substring match, no false-positive on an unrelated numeric needle, the"0"guard, and confirmation the existing fields still match (no regression).Test plan
go test ./internal/web/service/...— all packages passgo vet ./internal/web/service/...— cleanTestClientMatchesSearch_TgIDcovers the fix directly🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.