Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use resolve instead of remove, titleize plan and link to user fr… #244

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/controllers/web/admin/inquiries.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ async function retrieve(ctx) {
return ctx.render('admin/inquiries/retrieve');
}

async function remove(ctx) {
async function resolve(ctx) {
const inquiry = await Inquiries.findById(ctx.params.id);
if (!inquiry) throw Boom.notFound(ctx.translateError('INVALID_INQUIRY'));

await Inquiries.findById({ id: inquiry.id });
await Inquiries.findByIdAndUpdate(inquiry._id, {
$set: { is_resolved: true }
});

ctx.flash('custom', {
title: ctx.request.t('Success'),
Expand Down Expand Up @@ -213,4 +215,4 @@ async function bulkReply(ctx) {
else ctx.body = { redirectTo: '/admin/inquiries' };
}

module.exports = { list, retrieve, remove, reply, bulkReply };
module.exports = { list, retrieve, resolve, reply, bulkReply };
14 changes: 7 additions & 7 deletions app/views/admin/inquiries/_table.pug
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ include ../../_pagination
)
td.align-middle
a(
href=`mailto:${inquiry.email}`,
href=l(`/admin/users?mongodb_query={ email: "${user.email}" }`),
target="_blank",
rel="noopener noreferrer"
)= inquiry.email
td.align-middle
= inquiry.message
td.align-middle
= inquiry.plan
= titleize(humanize(inquiry.plan))
td.align-middle.dayjs(
data-time=new Date(inquiry.created_at).getTime()
)= dayjs(inquiry.created_at).format("M/D/YY h:mm A z")
Expand All @@ -47,7 +47,7 @@ include ../../_pagination
)= dayjs(inquiry.updated_at).format("M/D/YY h:mm A z")
td.align-middle
.btn-group(role="group", aria-label=t("Actions"))
a.btn.btn-secondary(
a.btn.btn-primary(
href=l(`/admin/inquiries/${inquiry.id}`),
data-toggle="tooltip",
data-title=t("Edit")
Expand All @@ -57,12 +57,12 @@ include ../../_pagination
method="POST",
autocomplete="off"
)
input(type="hidden", name="_method", value="DELETE")
button.btn.btn-danger(
input(type="hidden", name="_method", value="PUT")
button.btn.btn-secondary(
type="submit",
data-toggle="tooltip",
data-title=t("Remove")
): i.fa.fa-fw.fa-remove
data-title=t("Resolve")
): i.fa.fa-fw.fa-regular.fa-check-circle
button#bulk-reply-button.btn.btn-secondary.float-right.mb-3 Bulk Reply
#bulk-reply-modal.modal.fade(
tabindex="-1",
Expand Down
3 changes: 2 additions & 1 deletion locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "شكرًا لك،",
"Hi there, ": "أهلاً،",
"Inquiry does not exist.": "الاستفسار غير موجود.",
"An error occurred while attempting to send bulk reply. Please try again.": "حدث خطأ أثناء محاولة إرسال رد مجمع. حاول مرة اخرى."
"An error occurred while attempting to send bulk reply. Please try again.": "حدث خطأ أثناء محاولة إرسال رد مجمع. حاول مرة اخرى.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Děkuji,",
"Hi there, ": "Ahoj,",
"Inquiry does not exist.": "Dotaz neexistuje.",
"An error occurred while attempting to send bulk reply. Please try again.": "Při pokusu o odeslání hromadné odpovědi došlo k chybě. Prosím zkuste to znovu."
"An error occurred while attempting to send bulk reply. Please try again.": "Při pokusu o odeslání hromadné odpovědi došlo k chybě. Prosím zkuste to znovu.",
"Resolve": "Resolve"
}
4 changes: 3 additions & 1 deletion locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -3849,5 +3849,7 @@
"Hi there, ": "Hej,",
"Thank you,": "Tak skal du have,",
"Inquiry does not exist.": "Forespørgsel eksisterer ikke.",
"An error occurred while attempting to send bulk reply. Please try again.": "Der opstod en fejl under forsøg på at sende massesvar. Prøv igen."
"An error occurred while attempting to send bulk reply. Please try again.": "Der opstod en fejl under forsøg på at sende massesvar. Prøv igen.",
"Resolve": "Resolve",
"Request Time-out": "Request Time-out"
}
3 changes: 2 additions & 1 deletion locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -6414,5 +6414,6 @@
"Thank you,": "Danke schön,",
"Hi there, ": "Hallo, ",
"Inquiry does not exist.": "Anfrage existiert nicht.",
"An error occurred while attempting to send bulk reply. Please try again.": "Beim Senden einer Massenantwort ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut."
"An error occurred while attempting to send bulk reply. Please try again.": "Beim Senden einer Massenantwort ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7137,5 +7137,6 @@
"No inquiries exist for that search.": "No inquiries exist for that search.",
"Thank you,": "Thank you,",
"Hi there, ": "Hi there, ",
"We were unable to send your help request. We have been alerted of this problem. Please try again or directly email <a href=\"mailto:[email protected]\">[email protected]</a>.": "We were unable to send your help request. We have been alerted of this problem. Please try again or directly email <a href=\"mailto:[email protected]\">[email protected]</a>."
"We were unable to send your help request. We have been alerted of this problem. Please try again or directly email <a href=\"mailto:[email protected]\">[email protected]</a>.": "We were unable to send your help request. We have been alerted of this problem. Please try again or directly email <a href=\"mailto:[email protected]\">[email protected]</a>.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -7374,5 +7374,6 @@
"Thank you,": "Gracias,",
"Hi there, ": "Hola,",
"Inquiry does not exist.": "La consulta no existe.",
"An error occurred while attempting to send bulk reply. Please try again.": "Se produjo un error al intentar enviar una respuesta masiva. Inténtalo de nuevo."
"An error occurred while attempting to send bulk reply. Please try again.": "Se produjo un error al intentar enviar una respuesta masiva. Inténtalo de nuevo.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7223,5 +7223,6 @@
"Thank you,": "Kiitos,",
"Hi there, ": "Hei siellä,",
"Inquiry does not exist.": "Kyselyä ei ole olemassa.",
"An error occurred while attempting to send bulk reply. Please try again.": "Joukkovastauksen lähettämisessä tapahtui virhe. Yritä uudelleen."
"An error occurred while attempting to send bulk reply. Please try again.": "Joukkovastauksen lähettämisessä tapahtui virhe. Yritä uudelleen.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4867,5 +4867,6 @@
"Hi there, ": "Salut,",
"Thank you,": "Merci,",
"Inquiry does not exist.": "L'enquête n'existe pas.",
"An error occurred while attempting to send bulk reply. Please try again.": "Une erreur s'est produite lors de la tentative d'envoi d'une réponse groupée. Veuillez réessayer."
"An error occurred while attempting to send bulk reply. Please try again.": "Une erreur s'est produite lors de la tentative d'envoi d'une réponse groupée. Veuillez réessayer.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -5366,5 +5366,6 @@
"Hi there, ": "שלום שם,",
"Thank you,": "תודה,",
"Inquiry does not exist.": "חקירה לא קיימת.",
"An error occurred while attempting to send bulk reply. Please try again.": "אירעה שגיאה בעת ניסיון לשלוח תשובה בכמות גדולה. בבקשה נסה שוב."
"An error occurred while attempting to send bulk reply. Please try again.": "אירעה שגיאה בעת ניסיון לשלוח תשובה בכמות גדולה. בבקשה נסה שוב.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Köszönöm,",
"Hi there, ": "Szia,",
"Inquiry does not exist.": "A lekérdezés nem létezik.",
"An error occurred while attempting to send bulk reply. Please try again.": "Hiba történt a tömeges válasz küldése közben. Kérlek próbáld újra."
"An error occurred while attempting to send bulk reply. Please try again.": "Hiba történt a tömeges válasz küldése közben. Kérlek próbáld újra.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Terima kasih,",
"Hi there, ": "Hai, yang di sana,",
"Inquiry does not exist.": "Permintaan tidak ada.",
"An error occurred while attempting to send bulk reply. Please try again.": "Terjadi kesalahan saat mencoba mengirim balasan massal. Silakan coba lagi."
"An error occurred while attempting to send bulk reply. Please try again.": "Terjadi kesalahan saat mencoba mengirim balasan massal. Silakan coba lagi.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Grazie,",
"Hi there, ": "Ciao,",
"Inquiry does not exist.": "La richiesta non esiste.",
"An error occurred while attempting to send bulk reply. Please try again.": "Si è verificato un errore durante il tentativo di inviare una risposta collettiva. Per favore riprova."
"An error occurred while attempting to send bulk reply. Please try again.": "Si è verificato un errore durante il tentativo di inviare una risposta collettiva. Per favore riprova.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "ありがとう、",
"Hi there, ": "やあ、 ",
"Inquiry does not exist.": "問い合わせが存在しません。",
"An error occurred while attempting to send bulk reply. Please try again.": "一括返信の送信中にエラーが発生しました。もう一度お試しください。"
"An error occurred while attempting to send bulk reply. Please try again.": "一括返信の送信中にエラーが発生しました。もう一度お試しください。",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "감사합니다,",
"Hi there, ": "안녕하세요,",
"Inquiry does not exist.": "문의가 존재하지 않습니다.",
"An error occurred while attempting to send bulk reply. Please try again.": "대량 답장을 보내는 동안 오류가 발생했습니다. 다시 시도해 주세요."
"An error occurred while attempting to send bulk reply. Please try again.": "대량 답장을 보내는 동안 오류가 발생했습니다. 다시 시도해 주세요.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Bedankt,",
"Hi there, ": "Hoi,",
"Inquiry does not exist.": "Onderzoek bestaat niet.",
"An error occurred while attempting to send bulk reply. Please try again.": "Er is een fout opgetreden bij het verzenden van een bulkantwoord. Probeer het opnieuw."
"An error occurred while attempting to send bulk reply. Please try again.": "Er is een fout opgetreden bij het verzenden van een bulkantwoord. Probeer het opnieuw.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -7381,5 +7381,6 @@
"Thank you,": "Takk skal du ha,",
"Hi there, ": "Hei der,",
"Inquiry does not exist.": "Forespørsel eksisterer ikke.",
"An error occurred while attempting to send bulk reply. Please try again.": "Det oppstod en feil under forsøk på å sende massesvar. Vær så snill, prøv på nytt."
"An error occurred while attempting to send bulk reply. Please try again.": "Det oppstod en feil under forsøk på å sende massesvar. Vær så snill, prøv på nytt.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Dziękuję,",
"Hi there, ": "Cześć,",
"Inquiry does not exist.": "Zapytanie nie istnieje.",
"An error occurred while attempting to send bulk reply. Please try again.": "Wystąpił błąd podczas próby wysłania odpowiedzi zbiorczej. Proszę spróbuj ponownie."
"An error occurred while attempting to send bulk reply. Please try again.": "Wystąpił błąd podczas próby wysłania odpowiedzi zbiorczej. Proszę spróbuj ponownie.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Obrigado,",
"Hi there, ": "Olá,",
"Inquiry does not exist.": "A investigação não existe.",
"An error occurred while attempting to send bulk reply. Please try again.": "Ocorreu um erro ao tentar enviar uma resposta em massa. Por favor, tente novamente."
"An error occurred while attempting to send bulk reply. Please try again.": "Ocorreu um erro ao tentar enviar uma resposta em massa. Por favor, tente novamente.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Спасибо,",
"Hi there, ": "Всем привет,",
"Inquiry does not exist.": "Опрос не существует.",
"An error occurred while attempting to send bulk reply. Please try again.": "Произошла ошибка при попытке отправить массовый ответ. Пожалуйста, попробуйте еще раз."
"An error occurred while attempting to send bulk reply. Please try again.": "Произошла ошибка при попытке отправить массовый ответ. Пожалуйста, попробуйте еще раз.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Tack,",
"Hi there, ": "Hallå där,",
"Inquiry does not exist.": "Förfrågan finns inte.",
"An error occurred while attempting to send bulk reply. Please try again.": "Ett fel uppstod vid försök att skicka masssvar. Var god försök igen."
"An error occurred while attempting to send bulk reply. Please try again.": "Ett fel uppstod vid försök att skicka masssvar. Var god försök igen.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "ขอบคุณ,",
"Hi there, ": "สวัสดี,",
"Inquiry does not exist.": "ไม่มีการสอบถามข้อมูล",
"An error occurred while attempting to send bulk reply. Please try again.": "เกิดข้อผิดพลาดขณะพยายามส่งการตอบกลับจำนวนมาก กรุณาลองอีกครั้ง."
"An error occurred while attempting to send bulk reply. Please try again.": "เกิดข้อผิดพลาดขณะพยายามส่งการตอบกลับจำนวนมาก กรุณาลองอีกครั้ง.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Teşekkür ederim,",
"Hi there, ": "Merhaba,",
"Inquiry does not exist.": "Sorgulama mevcut değil.",
"An error occurred while attempting to send bulk reply. Please try again.": "Toplu yanıt gönderilmeye çalışılırken bir hata oluştu. Lütfen tekrar deneyin."
"An error occurred while attempting to send bulk reply. Please try again.": "Toplu yanıt gönderilmeye çalışılırken bir hata oluştu. Lütfen tekrar deneyin.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -7376,5 +7376,6 @@
"Thank you,": "Дякую тобі,",
"Hi there, ": "Привіт,",
"Inquiry does not exist.": "Запит не існує.",
"An error occurred while attempting to send bulk reply. Please try again.": "Під час спроби надіслати масову відповідь сталася помилка. Будь ласка спробуйте ще раз."
"An error occurred while attempting to send bulk reply. Please try again.": "Під час спроби надіслати масову відповідь сталася помилка. Будь ласка спробуйте ще раз.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4873,5 +4873,6 @@
"Hi there, ": "Chào bạn,",
"Thank you,": "Cảm ơn,",
"Inquiry does not exist.": "Yêu cầu không tồn tại.",
"An error occurred while attempting to send bulk reply. Please try again.": "Đã xảy ra lỗi khi cố gắng gửi thư trả lời hàng loạt. Vui lòng thử lại."
"An error occurred while attempting to send bulk reply. Please try again.": "Đã xảy ra lỗi khi cố gắng gửi thư trả lời hàng loạt. Vui lòng thử lại.",
"Resolve": "Resolve"
}
3 changes: 2 additions & 1 deletion locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -7069,5 +7069,6 @@
"Thank you,": "谢谢你,",
"Hi there, ": "你好呀, ",
"Inquiry does not exist.": "询价不存在。",
"An error occurred while attempting to send bulk reply. Please try again.": "尝试发送批量回复时出错。请重试。"
"An error occurred while attempting to send bulk reply. Please try again.": "尝试发送批量回复时出错。请重试。",
"Resolve": "Resolve"
}
2 changes: 1 addition & 1 deletion routes/web/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ router
.get('/inquiries/:id', web.admin.inquiries.retrieve)
.post('/inquiries/bulk', web.admin.inquiries.bulkReply)
.post('/inquiries/:id', web.admin.inquiries.reply)
.delete('/inquiries/:id', web.admin.inquiries.remove)
.put('/inquiries/:id', web.admin.inquiries.resolve)

// domains
.get('/domains', paginate.middleware(10, 50), web.admin.domains.list)
Expand Down
Loading