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