Skip to content

Commit 3d3f96f

Browse files
committed
remove decodeXML as it's not longer necessary
1 parent 09e89bf commit 3d3f96f

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

src/utils/builder.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -432,21 +432,6 @@ const buildCursor = result => {
432432
return data;
433433
};
434434

435-
const clearHyperlink = message => {
436-
const regex = /<a href="(.*)" rel="nofollow"><u>\1<\/u><\/a>/g;
437-
438-
return message.replace(regex, '$1');
439-
};
440-
441-
const decodeXML = message => {
442-
return message
443-
.replace(/&(quot|#34);/g, '"')
444-
.replace(/&(amp|#38);/g, '&')
445-
.replace(/&(apos|#39);/g, "'")
446-
.replace(/&(lt|#60);/g, '<')
447-
.replace(/&(gt|#62);/g, '>');
448-
};
449-
450435
const getInitials = name => {
451436
let initials;
452437

@@ -468,7 +453,7 @@ const buildChat = result => {
468453
const { chattimeline } = popcorn;
469454
data = convertToArray(chattimeline).map(chat => {
470455
const clear = chat._out ? parseFloat(chat._out) : -1;
471-
const message = decodeXML(clearHyperlink(chat._message));
456+
const message = chat._message;
472457
const initials = getInitials(chat._name);
473458
const emphasized = chat._chatEmphasizedText === 'true';
474459
const moderator = chat._senderRole === ROLES.MODERATOR;
@@ -626,7 +611,6 @@ export {
626611
addAlternatesToThumbnails,
627612
build,
628613
buildStyle,
629-
decodeXML,
630614
getAttr,
631615
getId,
632616
getNumbers,

src/utils/builder.test.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
buildStyle,
3-
decodeXML,
43
getAttr,
54
getId,
65
getNumbers,
@@ -57,33 +56,6 @@ it('builds style object from a string', () => {
5756
expect(buildStyle(value)).toEqual({});
5857
});
5958

60-
it('decodes XML predefined entities to character', () => {
61-
const entities = {
62-
'quot': `"`,
63-
'#34': `"`,
64-
'amp': `&`,
65-
'#38': `&`,
66-
'apos': `'`,
67-
'#39': `'`,
68-
'lt': `<`,
69-
'#60': `<`,
70-
'gt': `>`,
71-
'#62': `>`,
72-
};
73-
74-
for (let entity in entities) {
75-
if (Object.prototype.hasOwnProperty.call(entities, entity)) {
76-
expect(decodeXML(`&${entity};`)).toEqual(`${entities[entity]}`);
77-
expect(decodeXML(` &${entity};`)).toEqual(` ${entities[entity]}`);
78-
expect(decodeXML(`&${entity}; `)).toEqual(`${entities[entity]} `);
79-
expect(decodeXML(`&${entity};&${entity};`))
80-
.toEqual(`${entities[entity]}${entities[entity]}`);
81-
expect(decodeXML(`&${entity}; &${entity};`))
82-
.toEqual(`${entities[entity]} ${entities[entity]}`);
83-
}
84-
}
85-
});
86-
8759
it('gets attributes from a parsed xml node', () => {
8860
const attr = { first: 1, second: 'two' };
8961

@@ -130,4 +102,3 @@ it('gets a numeric array from a string', () => {
130102
expect(getNumbers(' ')).toEqual([]);
131103
expect(getNumbers()).toEqual([]);
132104
});
133-

0 commit comments

Comments
 (0)