Another batch of important updates and fixes

This commit is contained in:
Luka Romih
2026-02-23 15:29:58 +01:00
parent d0e53fee3b
commit fd02e25719
40 changed files with 216 additions and 71 deletions
+9
View File
@@ -12,6 +12,15 @@ exports.listComments = async (req, res) => {
}
if (filters.ctxType === 'entry_dict_int') {
if (!filters.ctxId) {
const NO_COMMENTS_OBJECT = {
page: 1,
numberOfAllPages: 1,
comments: [],
commentCount: 0
}
return res.send(NO_COMMENTS_OBJECT)
}
const { dictionary_id: dictionaryId } = await Entry.fetch(filters.ctxId)
const isEditor = req.user.hasAnyDictionaryRole(dictionaryId)
const isPortalAdmin = req.user.hasRole('portal admin')
+16 -5
View File
@@ -123,6 +123,8 @@ consultancy.createQuestion = async (req, res) => {
subject: subjectText,
html: emailHtml
})
// eslint-disable-next-line no-console
console.log(`Sent email to ${emails} (subject: ${subjectText})`)
res.status(201).send()
}
@@ -233,11 +235,14 @@ consultancy.assign = async (req, res) => {
const emailHtml = await renderAsync('email/consultancy-assigned')
// TODO i18n - What language are the email title and content (we already have email translated)
const emailSubject = req.t('Novo terminološko vprašanje')
await email.send({
to: emails,
subject: req.t('Novo terminološko vprašanje'),
subject: emailSubject,
html: emailHtml
})
// eslint-disable-next-line no-console
console.log(`Sent email to ${emails} (subject: ${emailSubject})`)
res.send()
}
@@ -289,11 +294,14 @@ consultancy.sendToReview = async (req, res) => {
const emailHtml = await renderAsync('email/consultancy-item-review')
// TODO i18n - What language are the email title and content (we already have email translated)
const emailSubject = req.t('Potrditev objave')
await email.send({
to: emails,
subject: req.t('Potrditev objave'),
subject: emailSubject,
html: emailHtml
})
// eslint-disable-next-line no-console
console.log(`Sent email to ${emails} (subject: ${emailSubject})`)
res.send()
}
@@ -318,13 +326,16 @@ consultancy.publish = async (req, res) => {
portalName
}
)
const emailSubject = i18next.t('Objava terminološkega vprašanja', {
lng: author.language
})
await email.send({
to: author.email,
subject: i18next.t('Objava terminološkega vprašanja', {
lng: author.language
}),
subject: emailSubject,
html: emailHtml
})
// eslint-disable-next-line no-console
console.log(`Sent email to ${author.email} (subject: ${emailSubject})`)
await ConsultancyEntry.publish(questionId, answerAuthors)
await ConsultancyEntry.indexIntoSearchEngine(questionId, true)
+1 -1
View File
@@ -55,7 +55,7 @@ dictionary.updateEntry = async (req, res) => {
}
dictionary.fetchEntries = async (req, res) => {
const dictionaryId = req.query.id
const { dictionaryId } = req.query
const hitsQuery = genEditorAllQuery(dictionaryId)
const hits = await searchEntryIndex(hitsQuery)
+4 -1
View File
@@ -218,11 +218,14 @@ extraction.begin = async (req, res) => {
extractionLink
}
)
const emailSubject = i18next.t('Luščenje končano', { lng: authorLanguage })
await email.send({
to: authorEmail,
subject: i18next.t('Luščenje končano', { lng: authorLanguage }),
subject: emailSubject,
html: emailHtml
})
// eslint-disable-next-line no-console
console.log(`Sent email to ${authorEmail} (subject: ${emailSubject})`)
} catch (error) {
// eslint-disable-next-line no-console
console.error(error)
+10 -3
View File
@@ -18,7 +18,8 @@ users.listUsers = async (req, res) => {
const { pages_total: numberOfAllPages, results } = await User.fetchAll(
resultsPerPage,
page
page,
true
)
res.send({ page, numberOfAllPages, results })
@@ -63,11 +64,14 @@ users.updateBasicData = async (req, res) => {
changeEmailLink
}
)
const emailSubject = req.t('Sprememba elektronskega naslova')
await email.send({
to: newEmail,
subject: req.t('Sprememba elektronskega naslova'),
subject: emailSubject,
html: emailHtml
})
// eslint-disable-next-line no-console
console.log(`Sent email to ${newEmail} (subject: ${emailSubject})`)
const message =
req.t(
@@ -103,11 +107,14 @@ users.updatePassword = async (req, res) => {
username: req.user.userName
}
)
const emailSubject = req.t('Sprememba gesla')
await email.send({
to: req.user.email,
subject: req.t('Sprememba gesla'),
subject: emailSubject,
html: emailHtml
})
// eslint-disable-next-line no-console
console.log(`Sent email to ${req.user.email} (subject: ${emailSubject})`)
req.flash('info', 'Geslo je bilo spremenjeno.')
res.send()