fix: браузер закрывается на ВСЕХ путях (try/finally в open_response_page, кроме ручного режима; confirm_send закрывает при ошибке); статус меняется при ok=true даже без скриншота

This commit is contained in:
apuc committed 2026-09-22 11:46:50 +03:00
1 parent 8ca070ed70
commit 06c142b1ea
2 files changed
+102 -83

No files matched your search

+13 -4
View File
@@ -679,14 +679,19 @@ async function sendFromModal() {
const data = await api(`/api/accounts/${currentAccount}/send-now`, {
method: 'POST', body: JSON.stringify({ id: sendModalId, message }),
});
if (data.ok && data.screenshot) {
showShotModal(sendModalId, data.screenshot, data.note || 'Отклик отправлен', true);
if (data.ok) {
// Отклик отправлен — статус меняем всегда, даже если скриншота нет
sentTexts.add(sendModalId);
const v = vacancies.find(x => x.id === sendModalId);
if (v) v.responded = true;
renderVacancies();
renderTexts();
closeSendModal();
if (data.screenshot) {
showShotModal(sendModalId, data.screenshot, data.note || 'Отклик отправлен', true);
} else {
alert(data.note || 'Отклик отправлен');
}
} else if (data.screenshot) {
// Бэкенд вернул скриншот, но отклик НЕ отправлен (например, не нашёл поле)
showShotModal(sendModalId, data.screenshot, data.note || 'Не удалось отправить отклик', false);
@@ -743,13 +748,17 @@ async function sendVacancy(id) {
method: 'POST', body: JSON.stringify({ id, message }),
});
if (note) note.textContent = data.note || '';
if (data.ok && data.screenshot) {
showShotModal(id, data.screenshot, data.note || 'Отклик отправлен', true);
if (data.ok) {
sentTexts.add(id);
const v = vacancies.find(x => x.id === id);
if (v) v.responded = true;
renderVacancies();
renderTexts();
if (data.screenshot) {
showShotModal(id, data.screenshot, data.note || 'Отклик отправлен', true);
} else {
alert(data.note || 'Отклик отправлен');
}
} else if (data.screenshot) {
showShotModal(id, data.screenshot, data.note || 'Не удалось отправить отклик', false);
} else {