Skip to content

Commit d22aa75

Browse files
committed
fix(notifications): remove old channel id from settings
1 parent f7935de commit d22aa75

File tree

5 files changed

+7
-59
lines changed

5 files changed

+7
-59
lines changed

dashboard/public/statics/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
"title": "Telegram",
165165
"description": "Configure Telegram notifications for important system activities",
166166
"apiToken": "Bot API Token",
167-
"adminId": "Admin Chat ID",
167+
"chatId": "Chat ID",
168168
"channelId": "Channel ID",
169169
"topicId": "Topic ID"
170170
},

dashboard/public/statics/locales/fa.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"title": "تلگرام",
6868
"description": "پیکربندی اعلان‌های ربات تلگرام برای دریافت هشدارهای بلادرنگ در چت یا کانال تلگرام شما",
6969
"apiToken": "توکن API ربات",
70-
"adminId": "شناسه چت مدیر",
70+
"chatId": "شناسه چت",
7171
"channelId": "شناسه کانال",
7272
"topicId": "شناسه تاپیک"
7373
},

dashboard/public/statics/locales/ru.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
"title": "Telegram",
176176
"description": "Настройка уведомлений Telegram-бота для получения оповещений в реальном времени в вашем чате или канале Telegram",
177177
"apiToken": "API токен бота",
178-
"adminId": "ID чата администратора",
178+
"chatId": "ID чата",
179179
"channelId": "ID канала",
180180
"topicId": "ID темы"
181181
},

dashboard/public/statics/locales/zh.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
"title": "Telegram",
145145
"description": "配置 Telegram 机器人通知,在您的 Telegram 聊天或频道中接收实时警报",
146146
"apiToken": "机器人 API 令牌",
147-
"adminId": "管理员聊天 ID",
147+
"chatId": "聊天 ID",
148148
"channelId": "频道 ID",
149149
"topicId": "主题 ID"
150150
},

dashboard/src/pages/_dashboard.settings.notifications.tsx

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
ChevronDown,
2121
Settings,
2222
Users,
23-
Shield,
2423
Globe,
2524
RotateCcw,
2625
UserCog,
@@ -321,7 +320,6 @@ export default function NotificationSettings() {
321320
notify_discord: false,
322321
telegram_api_token: '',
323322
telegram_chat_id: undefined,
324-
telegram_channel_id: undefined,
325323
telegram_topic_id: undefined,
326324
discord_webhook_url: '',
327325
proxy_url: '',
@@ -386,7 +384,6 @@ export default function NotificationSettings() {
386384
notify_discord: settings.notification_settings?.notify_discord || false,
387385
telegram_api_token: settings.notification_settings?.telegram_api_token || '',
388386
telegram_chat_id: settings.notification_settings?.telegram_chat_id || undefined,
389-
telegram_channel_id: settings.notification_settings?.telegram_channel_id || undefined,
390387
telegram_topic_id: settings.notification_settings?.telegram_topic_id || undefined,
391388
discord_webhook_url: settings.notification_settings?.discord_webhook_url || '',
392389
proxy_url: settings.notification_settings?.proxy_url || '',
@@ -430,13 +427,11 @@ export default function NotificationSettings() {
430427
? {
431428
telegram_api_token: data.notification_settings?.telegram_api_token || '',
432429
telegram_chat_id: data.notification_settings?.telegram_chat_id ?? null,
433-
telegram_channel_id: data.notification_settings?.telegram_channel_id ?? null,
434430
telegram_topic_id: data.notification_settings?.telegram_topic_id ?? null,
435431
}
436432
: {
437433
telegram_api_token: null,
438434
telegram_chat_id: null,
439-
telegram_channel_id: null,
440435
telegram_topic_id: null,
441436
}),
442437
// Only include Discord settings if Discord is enabled
@@ -486,7 +481,6 @@ export default function NotificationSettings() {
486481
notify_discord: settings.notification_settings?.notify_discord || false,
487482
telegram_api_token: settings.notification_settings?.telegram_api_token || '',
488483
telegram_chat_id: settings.notification_settings?.telegram_chat_id || undefined,
489-
telegram_channel_id: settings.notification_settings?.telegram_channel_id || undefined,
490484
telegram_topic_id: settings.notification_settings?.telegram_topic_id || undefined,
491485
discord_webhook_url: settings.notification_settings?.discord_webhook_url || '',
492486
proxy_url: settings.notification_settings?.proxy_url || '',
@@ -726,11 +720,11 @@ export default function NotificationSettings() {
726720
/>
727721
</div>
728722

729-
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
723+
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
730724
<div className="space-y-1.5">
731725
<Label className="flex items-center gap-1.5 text-xs font-medium sm:text-sm">
732-
<Shield className="h-3.5 w-3.5" />
733-
{t('settings.notifications.telegram.adminId')}
726+
<MessageSquare className="h-3.5 w-3.5" />
727+
{t('settings.notifications.telegram.chatId')}
734728
</Label>
735729
<FormField
736730
control={form.control}
@@ -773,52 +767,6 @@ export default function NotificationSettings() {
773767
/>
774768
</div>
775769

776-
<div className="space-y-1.5">
777-
<Label className="flex items-center gap-1.5 text-xs font-medium sm:text-sm">
778-
<MessageSquare className="h-3.5 w-3.5" />
779-
{t('settings.notifications.telegram.channelId')}
780-
</Label>
781-
<FormField
782-
control={form.control}
783-
name="notification_settings.telegram_channel_id"
784-
render={({ field }) => {
785-
const [inputValue, setInputValue] = useState(field.value?.toString() ?? '')
786-
787-
useEffect(() => {
788-
setInputValue(field.value?.toString() ?? '')
789-
}, [field.value])
790-
791-
return (
792-
<FormControl>
793-
<Input
794-
type="text"
795-
name={field.name}
796-
ref={field.ref}
797-
value={inputValue}
798-
onChange={e => {
799-
const value = e.target.value
800-
setInputValue(value)
801-
if (value === '') {
802-
field.onChange(undefined)
803-
} else if (/^-?\d+$/.test(value)) {
804-
field.onChange(parseInt(value))
805-
}
806-
}}
807-
onBlur={() => {
808-
if (inputValue !== '' && !/^-?\d+$/.test(inputValue)) {
809-
setInputValue(field.value?.toString() ?? '')
810-
}
811-
field.onBlur()
812-
}}
813-
className="h-9 text-xs sm:text-sm"
814-
placeholder="-1001234567890"
815-
/>
816-
</FormControl>
817-
)
818-
}}
819-
/>
820-
</div>
821-
822770
<div className="space-y-1.5">
823771
<Label className="flex items-center gap-1.5 text-xs font-medium sm:text-sm">
824772
<FileText className="h-3.5 w-3.5" />

0 commit comments

Comments
 (0)