فهرست منبع

fix(clients): include Telegram ID in client list search (#5888)

* fix(clients): include Telegram ID in client list search

clientMatchesSearch only checked Email/SubID/Comment/UUID/Password/Auth,
so searching the client list for a Telegram user ID never matched even
though the field is stored on every client.

This is a real regression, not a field that was simply never included:
before the paged search endpoint (#4500), the frontend searched with
ObjectUtil.deepSearch() over the full client object, which recursed into
every field including tgId. Replacing that with a fixed backend field
list silently dropped it (along with a few other fields, but tgId is the
one that's actually needed here since it's the panel's own way of
looking a client up when it only knows their Telegram ID).

TgID is int64 (0 = unset), so it can't sit in the existing []string
candidates array — matched separately via strconv, and skipped when 0 to
avoid a needle of "0" spuriously matching every client without a
Telegram ID.

Fixes #5880

* fix(clients): drop explanatory comment, mention Telegram ID in search hint

Addresses review feedback on #5888:
- Removed the // comment block above the TgID check in
  clientMatchesSearch per repo convention (code should read on its own).
- Updated searchPlaceholder in all 13 locale files to mention Telegram ID,
  since the search box now actually matches on it.

* test(clients): remove TgID search test per maintainer request
mrnickson-hue 1 روز پیش
والد
کامیت
ed9686bf29

+ 3 - 0
internal/web/service/client_paging.go

@@ -290,6 +290,9 @@ func clientMatchesSearch(c ClientWithAttachments, needle string) bool {
 			return true
 		}
 	}
+	if c.TgID != 0 && strings.Contains(strconv.FormatInt(c.TgID, 10), needle) {
+		return true
+	}
 	return false
 }
 

+ 1 - 1
internal/web/translation/ar-EG.json

@@ -775,7 +775,7 @@
       "renew": "تجديد تلقائي",
       "renewDesc": "تجديد تلقائي بعد انتهاء الصلاحية. (0 = تعطيل) (الوحدة: يوم)",
       "renewDays": "تجديد تلقائي (أيام)",
-      "searchPlaceholder": "ابحث بالبريد، التعليق، sub ID، UUID، كلمة المرور، auth…",
+      "searchPlaceholder": "ابحث بالبريد، التعليق، sub ID، UUID، كلمة المرور، auth، Telegram ID…",
       "filterTitle": "تصفية العملاء",
       "clearAllFilters": "مسح الكل",
       "filters": {

+ 1 - 1
internal/web/translation/en-US.json

@@ -775,7 +775,7 @@
       "renew": "Auto Renew",
       "renewDesc": "Auto-renewal after expiration. (0 = disable)(unit: day)",
       "renewDays": "Auto Renew (days)",
-      "searchPlaceholder": "Search email, comment, sub ID, UUID, password, auth…",
+      "searchPlaceholder": "Search email, comment, sub ID, UUID, password, auth, Telegram ID…",
       "filterTitle": "Filter clients",
       "clearAllFilters": "Clear all",
       "filters": {

+ 1 - 1
internal/web/translation/es-ES.json

@@ -775,7 +775,7 @@
       "renew": "Renovación automática",
       "renewDesc": "Renovación automática tras la expiración. (0 = desactivado) (unidad: día)",
       "renewDays": "Renovación automática (días)",
-      "searchPlaceholder": "Buscar email, comentario, sub ID, UUID, contraseña, auth…",
+      "searchPlaceholder": "Buscar email, comentario, sub ID, UUID, contraseña, auth, Telegram ID…",
       "filterTitle": "Filtrar clientes",
       "clearAllFilters": "Limpiar todo",
       "filters": {

+ 1 - 1
internal/web/translation/fa-IR.json

@@ -775,7 +775,7 @@
       "renew": "تمدید خودکار",
       "renewDesc": "تمدید خودکار پس از انقضا. (۰ = غیرفعال) (واحد: روز)",
       "renewDays": "تمدید خودکار (روز)",
-      "searchPlaceholder": "جستجوی ایمیل، توضیح، Sub ID، UUID، رمز، احراز...",
+      "searchPlaceholder": "جستجوی ایمیل، توضیح، Sub ID، UUID، رمز، احراز، Telegram ID...",
       "filterTitle": "فیلتر کاربران",
       "clearAllFilters": "پاک کردن همه",
       "filters": {

+ 1 - 1
internal/web/translation/id-ID.json

@@ -775,7 +775,7 @@
       "renew": "Perpanjangan otomatis",
       "renewDesc": "Perpanjangan otomatis setelah kedaluwarsa. (0 = nonaktif) (satuan: hari)",
       "renewDays": "Perpanjangan otomatis (hari)",
-      "searchPlaceholder": "Cari email, komentar, sub ID, UUID, kata sandi, auth…",
+      "searchPlaceholder": "Cari email, komentar, sub ID, UUID, kata sandi, auth, Telegram ID…",
       "filterTitle": "Filter klien",
       "clearAllFilters": "Hapus semua",
       "filters": {

+ 1 - 1
internal/web/translation/ja-JP.json

@@ -775,7 +775,7 @@
       "renew": "自動更新",
       "renewDesc": "有効期限切れ後に自動更新します。(0 = 無効) (単位: 日)",
       "renewDays": "自動更新 (日)",
-      "searchPlaceholder": "メール、コメント、sub ID、UUID、パスワード、auth を検索…",
+      "searchPlaceholder": "メール、コメント、sub ID、UUID、パスワード、auth、Telegram ID を検索…",
       "filterTitle": "クライアントをフィルタ",
       "clearAllFilters": "すべてクリア",
       "filters": {

+ 1 - 1
internal/web/translation/pt-BR.json

@@ -775,7 +775,7 @@
       "renew": "Renovação automática",
       "renewDesc": "Renovação automática após a expiração. (0 = desativar) (unidade: dia)",
       "renewDays": "Renovação automática (dias)",
-      "searchPlaceholder": "Buscar email, comentário, sub ID, UUID, senha, auth…",
+      "searchPlaceholder": "Buscar email, comentário, sub ID, UUID, senha, auth, Telegram ID…",
       "filterTitle": "Filtrar clientes",
       "clearAllFilters": "Limpar tudo",
       "filters": {

+ 1 - 1
internal/web/translation/ru-RU.json

@@ -775,7 +775,7 @@
       "renew": "Автопродление",
       "renewDesc": "Автоматическое продление после окончания. (0 = отключено) (единица: день)",
       "renewDays": "Автопродление (дней)",
-      "searchPlaceholder": "Поиск email, комментария, sub ID, UUID, пароля, auth…",
+      "searchPlaceholder": "Поиск email, комментария, sub ID, UUID, пароля, auth, Telegram ID…",
       "filterTitle": "Фильтр клиентов",
       "clearAllFilters": "Очистить все",
       "filters": {

+ 1 - 1
internal/web/translation/tr-TR.json

@@ -775,7 +775,7 @@
       "renew": "Otomatik Yenileme",
       "renewDesc": "Süre dolduktan sonra otomatik yeniler. (0 = devre dışı) (birim: gün)",
       "renewDays": "Otomatik Yenileme (gün)",
-      "searchPlaceholder": "E-posta, yorum, sub ID, UUID, parola, auth ara…",
+      "searchPlaceholder": "E-posta, yorum, sub ID, UUID, parola, auth, Telegram ID ara…",
       "filterTitle": "Kullanıcıları Filtrele",
       "clearAllFilters": "Tümünü Temizle",
       "filters": {

+ 1 - 1
internal/web/translation/uk-UA.json

@@ -775,7 +775,7 @@
       "renew": "Авто-продовження",
       "renewDesc": "Автоматичне продовження після закінчення. (0 = вимкнено) (одиниця: день)",
       "renewDays": "Авто-продовження (днів)",
-      "searchPlaceholder": "Пошук email, коментаря, sub ID, UUID, паролю, auth…",
+      "searchPlaceholder": "Пошук email, коментаря, sub ID, UUID, паролю, auth, Telegram ID…",
       "filterTitle": "Фільтр клієнтів",
       "clearAllFilters": "Очистити все",
       "filters": {

+ 1 - 1
internal/web/translation/vi-VN.json

@@ -775,7 +775,7 @@
       "renew": "Tự động gia hạn",
       "renewDesc": "Tự động gia hạn sau khi hết hạn. (0 = tắt) (đơn vị: ngày)",
       "renewDays": "Tự động gia hạn (ngày)",
-      "searchPlaceholder": "Tìm email, ghi chú, sub ID, UUID, mật khẩu, auth…",
+      "searchPlaceholder": "Tìm email, ghi chú, sub ID, UUID, mật khẩu, auth, Telegram ID…",
       "filterTitle": "Lọc client",
       "clearAllFilters": "Xóa tất cả",
       "filters": {

+ 1 - 1
internal/web/translation/zh-CN.json

@@ -775,7 +775,7 @@
       "renew": "自动续期",
       "renewDesc": "到期后自动续期。(0 = 禁用) (单位: 天)",
       "renewDays": "自动续期 (天)",
-      "searchPlaceholder": "搜索邮箱、备注、sub ID、UUID、密码、auth…",
+      "searchPlaceholder": "搜索邮箱、备注、sub ID、UUID、密码、auth、Telegram ID…",
       "filterTitle": "筛选客户端",
       "clearAllFilters": "清除全部",
       "filters": {

+ 1 - 1
internal/web/translation/zh-TW.json

@@ -775,7 +775,7 @@
       "renew": "自動續期",
       "renewDesc": "到期後自動續期。(0 = 停用) (單位: 天)",
       "renewDays": "自動續期 (天)",
-      "searchPlaceholder": "搜尋電子郵件、備註、sub ID、UUID、密碼、auth…",
+      "searchPlaceholder": "搜尋電子郵件、備註、sub ID、UUID、密碼、auth、Telegram ID…",
       "filterTitle": "篩選客戶端",
       "clearAllFilters": "清除全部",
       "filters": {