some
This commit is contained in:
parent
ff66cd7bf0
commit
3437cea13c
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "telegram-invite-automation",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"private": true,
|
||||
"description": "Automated user parsing and invites for Telegram groups",
|
||||
"main": "src/main/index.js",
|
||||
|
||||
@ -108,49 +108,52 @@ export default function useTaskActions({
|
||||
setTaskNotice({ text: `Автоназначены аккаунты: ${accountIds.length}`, tone: "success", source });
|
||||
}
|
||||
}
|
||||
if (!accountIds.length) {
|
||||
if (!silent) {
|
||||
showNotification("Нет аккаунтов для этой задачи.", "error");
|
||||
}
|
||||
return;
|
||||
}
|
||||
const hasNoAccounts = !accountIds.length;
|
||||
const roleEntries = Object.values(accountRolesMap);
|
||||
if (roleEntries.length) {
|
||||
const hasMonitor = roleEntries.some((item) => item.monitor);
|
||||
const hasInvite = roleEntries.some((item) => item.invite);
|
||||
const hasConfirm = roleEntries.some((item) => item.confirm);
|
||||
if (!hasMonitor) {
|
||||
if (!silent) {
|
||||
showNotification("Нужен хотя бы один аккаунт с ролью мониторинга.", "error");
|
||||
if (accountIds.length > 0) {
|
||||
if (roleEntries.length) {
|
||||
const hasMonitor = roleEntries.some((item) => item.monitor);
|
||||
const hasInvite = roleEntries.some((item) => item.invite);
|
||||
const hasConfirm = roleEntries.some((item) => item.confirm);
|
||||
if (!hasMonitor) {
|
||||
if (!silent) {
|
||||
showNotification("Нужен хотя бы один аккаунт с ролью мониторинга.", "error");
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!hasInvite) {
|
||||
if (!silent) {
|
||||
showNotification("Нужен хотя бы один аккаунт с ролью инвайта.", "error");
|
||||
if (!hasInvite) {
|
||||
if (!silent) {
|
||||
showNotification("Нужен хотя бы один аккаунт с ролью инвайта.", "error");
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (nextForm.separateConfirmRoles && !hasConfirm) {
|
||||
if (!silent) {
|
||||
showNotification("Нужен хотя бы один аккаунт с ролью подтверждения.", "error");
|
||||
if (nextForm.separateConfirmRoles && !hasConfirm) {
|
||||
if (!silent) {
|
||||
showNotification("Нужен хотя бы один аккаунт с ролью подтверждения.", "error");
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const requiredAccounts = nextForm.requireSameBotInBoth
|
||||
? Math.max(1, Number(nextForm.maxCompetitorBots || 1))
|
||||
: nextForm.separateBotRoles
|
||||
} else {
|
||||
const requiredAccounts = nextForm.requireSameBotInBoth
|
||||
? Math.max(1, Number(nextForm.maxCompetitorBots || 1))
|
||||
+ Math.max(1, Number(nextForm.maxOurBots || 1))
|
||||
+ (nextForm.separateConfirmRoles ? Math.max(1, Number(nextForm.maxConfirmBots || 1)) : 0)
|
||||
: 1;
|
||||
if (accountIds.length < requiredAccounts) {
|
||||
if (!silent) {
|
||||
showNotification(`Нужно минимум ${requiredAccounts} аккаунтов для выбранного режима.`, "error");
|
||||
: nextForm.separateBotRoles
|
||||
? Math.max(1, Number(nextForm.maxCompetitorBots || 1))
|
||||
+ Math.max(1, Number(nextForm.maxOurBots || 1))
|
||||
+ (nextForm.separateConfirmRoles ? Math.max(1, Number(nextForm.maxConfirmBots || 1)) : 0)
|
||||
: 1;
|
||||
if (accountIds.length < requiredAccounts) {
|
||||
if (!silent) {
|
||||
showNotification(`Нужно минимум ${requiredAccounts} аккаунтов для выбранного режима.`, "error");
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (!silent) {
|
||||
setTaskNotice({
|
||||
text: "Задача сохранена как черновик. Добавьте аккаунты во вкладке «Аккаунты».",
|
||||
tone: "warn",
|
||||
source
|
||||
});
|
||||
}
|
||||
const accountRoles = Object.entries(accountRolesMap).map(([id, roles]) => ({
|
||||
accountId: Number(id),
|
||||
@ -167,7 +170,13 @@ export default function useTaskActions({
|
||||
});
|
||||
if (result.ok) {
|
||||
if (!silent) {
|
||||
setTaskNotice({ text: "Задача сохранена.", tone: "success", source });
|
||||
setTaskNotice({
|
||||
text: hasNoAccounts
|
||||
? "Задача сохранена как черновик. Добавьте аккаунты во вкладке «Аккаунты»."
|
||||
: "Задача сохранена.",
|
||||
tone: hasNoAccounts ? "warn" : "success",
|
||||
source
|
||||
});
|
||||
} else {
|
||||
setAutosaveNote("Автосохранено");
|
||||
if (autosaveNoteTimer.current) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user