diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js
index e17093839..dabd35f80 100644
--- a/back/methods/osticket/sendToSupport.js
+++ b/back/methods/osticket/sendToSupport.js
@@ -29,35 +29,34 @@ module.exports = Self => {
});
Self.sendToSupport = async(ctx, reason, additionalData) => {
+ const userId = ctx.req.accessToken.userId;
const emailUser =
- await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']});
+ await Self.app.models.EmailUser.findById(userId, {fields: ['email']});
- let html = `Motivo:
${reason}
`;
- html += `Usuario:
${ctx.req.accessToken.userId} ${emailUser.email}
`;
+ let html = `
Motivo: ${reason}
`;
+ html += `Usuario: ${userId} ${emailUser.email}
`;
+ html += `Additional Data:
`;
+ html += '';
+ for (const [key, val] of Object.entries(additionalData)) {
+ if (key !== 'config') html += `- ${key}: ${parse(val)}
`;
+ else {
+ html += `- ${key}:
`;
+ for (const [confKey, confVal] of Object.entries(val))
+ html += `- ${confKey}: ${parse(confVal)}
`;
+ html += '
';
+ }
+ }
+ html += '
';
- delete additionalData.backError.config.headers.Authorization;
- const httpRequest = JSON.parse(additionalData?.httpRequest);
-
- if (httpRequest)
- delete httpRequest.config.headers.Authorization;
- additionalData.httpRequest = httpRequest;
-
- for (const data in additionalData)
- html += `${data}:
${tryParse(additionalData[data])}
`;
-
- const subjectReason = httpRequest?.data?.error;
+ const {message, path, name} = additionalData;
await smtp.send({
to: `${config.app.reportEmail}, ${emailUser.email}`,
- subject:
- '[Support-Salix] ' +
- additionalData?.frontPath + ' ' +
- subjectReason?.name + ':' +
- subjectReason?.message,
+ subject: `[Support-Salix] ${path} ${name}: ${message}`,
html
});
};
- function tryParse(value) {
+ function parse(value) {
try {
try {
value = JSON.parse(value);
diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js
index b380c47c3..cce285d14 100644
--- a/front/core/components/snackbar/snackbar.js
+++ b/front/core/components/snackbar/snackbar.js
@@ -27,18 +27,6 @@ export default class Controller extends Component {
setTimeout(() => element.classList.add('shown'), 30);
shape.element = element;
- if (data.additionalData && this.vnToken.token) {
- this.additionalData = data.additionalData;
- let supportButton = document.createElement('i');
- supportButton.setAttribute('class', 'material-icons clickable');
- supportButton.addEventListener('click', () => this.$.supportDialog.show());
- element.appendChild(supportButton);
-
- let buttonIcon = 'support_agent';
- buttonIcon = document.createTextNode(buttonIcon);
- supportButton.appendChild(buttonIcon);
- }
-
if (shape.type)
element.classList.add(shape.type);
diff --git a/front/core/components/support-dialog/index.js b/front/core/components/support-dialog/index.js
index d15c14b4a..82f086184 100644
--- a/front/core/components/support-dialog/index.js
+++ b/front/core/components/support-dialog/index.js
@@ -9,13 +9,6 @@ export default class Controller extends Dialog {
responseHandler(response) {
if (response !== 'accept')
return super.responseHandler(response);
-
- this.$http.post('Ostickets/send-to-support', {
- reason: this.reason,
- additionalData: this.additionalData
- })
- .then(() => super.responseHandler(response))
- .then(() => this.vnApp.showSuccess(this.$t('Email sended!')));
}
}