Skip to content

Commit e6e9f74

Browse files
authored
Merge pull request #119 from coder-mind-project/release-v-1.1.7
Release: version 1.1.7 + Peer dependencies updated
2 parents 6653511 + 0cba562 commit e6e9f74

22 files changed

+7957
-178
lines changed

api/articles/articles.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,10 @@ module.exports = app => {
636636

637637
const { article, stateTimestamp } = await validateState(id, user, state)
638638

639-
await Article.updateOne({ _id: id }, { state, [stateTimestamp]: !article[stateTimestamp] ? MyDate.setTimeZone('-3') : article[stateTimestamp] })
639+
await Article.updateOne(
640+
{ _id: id },
641+
{ state, [stateTimestamp]: !article[stateTimestamp] ? MyDate.setTimeZone('-3') : article[stateTimestamp] }
642+
)
640643

641644
return res.status(204).send()
642645
} catch (error) {
@@ -808,7 +811,7 @@ module.exports = app => {
808811
const imgValue = req.file.location
809812

810813
if (article[imgKey]) {
811-
const { status, key, error } = getBucketKeyFromUrl(article[imgKey])
814+
const { status, key } = getBucketKeyFromUrl(article[imgKey])
812815
if (!status) return
813816

814817
s3.deleteObject({ Bucket: bucket, Key: key }, (err, data) => {

api/articles/comments/emails.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ module.exports = app => {
2727
const author = answer.userName
2828
const article = {
2929
title: comment.article.title,
30-
customUrl: `${webApp.default}/artigos/${comment.article.customURL}`
30+
customUri: `${webApp.default}/artigos/${comment.article.customUri}`
3131
}
3232

3333
const variables = [
3434
{ key: '__user', value: reader.name },
3535
{ key: '__author', value: author },
3636
{ key: '__article', value: article.title },
37-
{ key: '__url', value: article.customUrl }
37+
{ key: '__url', value: article.customUri }
3838
]
3939

4040
const textParams = {
4141
user: reader.name,
4242
author,
4343
article: article.title,
44-
url: article.customUrl
44+
url: article.customUri
4545
}
4646

4747
const textMsg = answerSentTxtMsg

api/articles/likes/likes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,5 +418,5 @@ module.exports = app => {
418418
})
419419
}
420420

421-
return { getLatest, get, getCount, synchronizeLikes }
421+
return { getLatest, get, getCount, synchronizeLikes, getCountRealTime }
422422
}

api/articles/views/views.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,5 +405,5 @@ module.exports = app => {
405405
})
406406
}
407407

408-
return { get, getLatest, getCount, synchronizeViews }
408+
return { get, getLatest, getCount, synchronizeViews, getCountRealTime }
409409
}

api/auth/auth.routes.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const { isAdmin } = require('../../config/authentication/accessLevel')
2-
31
module.exports = app => {
42
/**
53
* @name Authentication

api/users/users.js

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ module.exports = app => {
141141
*/
142142
const validateUserCellphone = async (userToUpdate, userInDatabase) => {
143143
if (userToUpdate.cellphone) {
144-
const documents = await User.countDocuments({ _id: { $ne: userInDatabase._id }, cellphone: userToUpdate.cellphone })
144+
const documents = await User.countDocuments({
145+
_id: { $ne: userInDatabase._id },
146+
cellphone: userToUpdate.cellphone
147+
})
145148
if (documents) {
146149
throw {
147150
name: 'cellphone',
@@ -306,7 +309,7 @@ module.exports = app => {
306309
}
307310
}
308311

309-
const token = user && user.confirmEmailToken ? JSON.parse(decryptToken(user.confirmEmailToken)) : null
312+
const token = user.confirmEmailToken ? JSON.parse(decryptToken(user.confirmEmailToken)) : null
310313

311314
// Validate the token issuer
312315
if (!token || token.issuer !== issuer) {
@@ -616,57 +619,6 @@ module.exports = app => {
616619
}
617620
}
618621

619-
/**
620-
* @function
621-
* @description Remove/Delete an User permanently.
622-
* This middleware is not accessible for production releases, use only for development.
623-
* To use, add a new route and point to this middleware.
624-
*
625-
* @param {Object} req - Request object provided by Express.js
626-
* @param {Object} res - Response object provided by Express.js
627-
*
628-
* @middlewareParams {String} id - The User identifier
629-
*/
630-
const removePermanently = async (req, res) => {
631-
try {
632-
const _id = req.params.id
633-
634-
const user = await User.findOne({ _id })
635-
636-
if (!user) {
637-
throw {
638-
name: '_id',
639-
description: 'Usuário não encontrado'
640-
}
641-
}
642-
643-
const result = await deleteUser(_id)
644-
645-
if (result.deletedCount) {
646-
const payload = {
647-
status: true,
648-
data: [
649-
{
650-
_id: user.id,
651-
name: user.name,
652-
cellphone: user.cellphone,
653-
password: user.password,
654-
deleted_at: new Date()
655-
}
656-
]
657-
}
658-
659-
// Write removed users in another database
660-
writeRemovedUsers(payload, true)
661-
662-
return res.status(204).send()
663-
}
664-
} catch (error) {
665-
const stack = userError(error)
666-
return res.status(stack.code).send(stack)
667-
}
668-
}
669-
670622
/**
671623
* @function
672624
* @description Restore a deleted user (Only for soft deleted users).
@@ -819,7 +771,7 @@ module.exports = app => {
819771
const currentProfilePhoto = user.profilePhoto || null
820772

821773
if (currentProfilePhoto) {
822-
const { status, key, error } = getBucketKeyFromUrl(currentProfilePhoto)
774+
const { status, key } = getBucketKeyFromUrl(currentProfilePhoto)
823775
if (!status) return
824776

825777
s3.deleteObject({ Bucket: bucket, Key: key }, (err, data) => {

assets/emails/answerSent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<td align="center" style="padding:10px;Margin:0;"><span class="es-button-border es-button-border-2" style="border-style:solid;border-color:#2CB543;background:#8A05BE;border-width:0px;display:inline-block;border-radius:20px;width:auto;"><a href="__url" class="es-button es-button-1" target="_blank" style="mso-style-priority:100 !important;text-decoration:none;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:18px;color:#FFFFFF;border-style:solid;border-color:#8A05BE;border-width:10px 20px 10px 20px;display:inline-block;background:#8A05BE;border-radius:20px;font-weight:normal;font-style:normal;line-height:22px;width:auto;text-align:center;">Ver resposta</a></span></td>
169169
</tr>
170170
<tr style="border-collapse:collapse;">
171-
<td align="center" style="padding:0;Margin:0;padding-bottom:25px;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><br></p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2020<br><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br </a></p></td>
171+
<td align="center" style="padding:0;Margin:0;padding-bottom:25px;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><br></p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2021<br><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br </a></p></td>
172172
</tr>
173173
</table></td>
174174
</tr>

assets/emails/emailChangedMyAccount.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
<td align="left" style="padding:0;Margin:0;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;">Para confirmar a troca, basta clicar no link abaixo, e realizar o login novamente:</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;"><br></p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;"><a target="_blank" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#8A05BE;" href="__url/confirm-email?uid=___id&token=__token">Clique aqui</a> para confirmar a troca de e-mail</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;"><br></p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;">Você tem 48 horas a partir da solicitação da troca de e-mail para efetivar a troca, caso expire o prazo terá que solicitar novamente.</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;">Para validar, basta clicar no link e aguardar. Assim que confirmado o sistema irá lhe redirecionar para a tela de login.</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;"><br></p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#131313;">Não solicitou a troca de e-mail? <a target="_blank" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#8A05BE;" href="__url/confirm-email?uid=___id&token=__token&rt=true">Clique aqui</a><br></p></td>
132132
</tr>
133133
<tr style="border-collapse:collapse;">
134-
<td align="center" style="padding:0;Margin:0;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><br></p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2020<br><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br </a></p></td>
134+
<td align="center" style="padding:0;Margin:0;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><br></p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2021<br><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br </a></p></td>
135135
</tr>
136136
</table></td>
137137
</tr>

assets/emails/newAccount.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<td width="540" align="center" valign="top" style="padding:0;Margin:0;">
171171
<table cellpadding="0" cellspacing="0" width="100%" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;">
172172
<tr style="border-collapse:collapse;">
173-
<td align="center" style="padding:0;Margin:0;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#817A7A;">© Coder Mind - 2020&nbsp;</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#817A7A;"><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#817A7A;">www.codermind.com.br</a></p>
173+
<td align="center" style="padding:0;Margin:0;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#817A7A;">© Coder Mind - 2021&nbsp;</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#817A7A;"><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#817A7A;">www.codermind.com.br</a></p>
174174
<ul></ul></td>
175175
</tr>
176176
</table></td>

assets/emails/puretext/newAccount.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
module.exports = (payload) => {
2-
return ` Seja bem vindo a Coder Mind
1+
module.exports = payload => {
2+
return ` Seja bem vindo a Coder Mind
33
\n\n
44
Um de nossos administradores registrou uma nova conta neste endereço de e-mail, e o que isto significa?
55
\n
@@ -23,9 +23,9 @@ module.exports = (payload) => {
2323
\n
2424
${payload.notAcceptAccountLink}
2525
\n\n
26-
© Coder Mind - 2020
26+
© Coder Mind - 2021
2727
\n
2828
www.codermind.com.br
2929
\n\n\n\n
3030
`
31-
}
31+
}

assets/emails/ticketAnswered.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
<ul></ul></td>
157157
</tr>
158158
<tr style="border-collapse:collapse;">
159-
<td align="center" style="padding:0;Margin:0;padding-top:25px;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2020</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br</a></p>
159+
<td align="center" style="padding:0;Margin:0;padding-top:25px;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2021</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br</a></p>
160160
<ul></ul></td>
161161
</tr>
162162
</table></td>

assets/emails/ticketReceived.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
<ul></ul></td>
134134
</tr>
135135
<tr style="border-collapse:collapse;">
136-
<td align="center" style="padding:0;Margin:0;padding-top:25px;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2020</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br</a></p>
136+
<td align="center" style="padding:0;Margin:0;padding-top:25px;"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;">© Coder Mind - 2021</p><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:16px;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;line-height:24px;color:#887A7A;"><a target="_blank" href="http://www.codermind.com.br" style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:roboto, 'helvetica neue', helvetica, arial, sans-serif;font-size:16px;text-decoration:underline;color:#887A7A;">www.codermind.com.br</a></p>
137137
<ul></ul></td>
138138
</tr>
139139
</table></td>

0 commit comments

Comments
 (0)