Skip to content

Commit

Permalink
Merge pull request #3 from Testlio/feature/move-decoding-to-issue-ser…
Browse files Browse the repository at this point in the history
…vice/GREY-3924

moved decoding to issue-service
  • Loading branch information
valdopurde authored Jun 28, 2023
2 parents f360987 + ed4284f commit 91171d7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1,467 deletions.
4 changes: 1 addition & 3 deletions formatters/comment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const Entities = require('html-entities').Html5Entities;
const moment = require('moment');

/**
Expand Down Expand Up @@ -30,11 +29,10 @@ exports.toLocal = (remoteData) => {
* @returns {Object} data in remote service format
*/
exports.toRemote = (data, resource) => {
const entities = new Entities();
return {
data: {
task: Number(resource.parent.id),
text: entities.decode(data.comment)
text: data.comment
}
};
};
6 changes: 2 additions & 4 deletions formatters/issue.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const Entities = require('html-entities').Html5Entities;
const _ = require('lodash');
const SEVERITY = require('../constants/severity');
const STATE = require('../constants/state');
Expand Down Expand Up @@ -98,9 +97,8 @@ exports.toLocal = (remoteData) => {
* @returns {Object} data in remote service format
*/
exports.toRemote = (issue, integration, resource) => {
const entities = new Entities();
const title = issue.issueData.title === EMPTY_TITLE ? '' : entities.decode(issue.issueData.title);
const description = issue.issueData.description === EMPTY_DESCRIPTION ? '' : entities.decode(issue.issueData.description);
const title = issue.issueData.title === EMPTY_TITLE ? '' : issue.issueData.title;
const description = issue.issueData.description === EMPTY_DESCRIPTION ? '' : issue.issueData.description;
const tags = _.concat(issue.issueData.labels, [toRemoteSeverity(issue.issueData.severity), TESTLIO_TAG]);
return {
data: {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"content-disposition": "^0.5.2",
"dotenv": "^2.0.0",
"fs": "^0.0.1-security",
"html-entities": "^1.2.0",
"joi": "^10.1.0",
"jsonwebtoken": "^7.1.9",
"keymirror": "^0.1.1",
Expand Down
Loading

0 comments on commit 91171d7

Please sign in to comment.