From da55b0d4352d2daf4a8d9f4130d34546e9f01555 Mon Sep 17 00:00:00 2001 From: kPherox Date: Wed, 19 Feb 2020 20:57:58 +0900 Subject: Add fields_text for tooltip --- .../services/entity_normalizer/entity_normalizer.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js index cfb380ba..9df84575 100644 --- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js +++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js @@ -290,6 +290,19 @@ describe('API Entities normalizer', () => { expect(field).to.have.property('value').that.contains(' { + const user = makeMockUserMasto({ emojis: makeMockEmojiMasto(), fields: [{ name: 'user', value: '@user' }] }) + + const parsedUser = parseUser(user) + + expect(parsedUser).to.have.property('fields_text').to.be.an('array') + + const field = parsedUser.fields_text[0] + + expect(field).to.have.property('name').that.equal('user') + expect(field).to.have.property('value').that.equal('@user') + }) + it('adds hide_follows and hide_followers user settings', () => { const user = makeMockUserMasto({ pleroma: { hide_followers: true, hide_follows: false, hide_followers_count: false, hide_follows_count: true } }) -- cgit v1.2.3-70-g09d2 From 8d7d4980b9a9c68e3c36dc00dfc85e39842b03f7 Mon Sep 17 00:00:00 2001 From: lain Date: Thu, 11 Jun 2020 18:39:19 +0200 Subject: StatusParser: Remove unused removeAttachmentLinks. Brings down the vendor by over 200kb --- package.json | 3 +-- src/services/status_parser/status_parser.js | 15 --------------- .../specs/services/status_parser/status_parses.spec.js | 17 ----------------- 3 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 test/unit/specs/services/status_parser/status_parses.spec.js (limited to 'test') diff --git a/package.json b/package.json index 4d68cc6e..42efc7e9 100644 --- a/package.json +++ b/package.json @@ -22,12 +22,10 @@ "cropperjs": "^1.4.3", "diff": "^3.0.1", "escape-html": "^1.0.3", - "karma-mocha-reporter": "^2.2.1", "localforage": "^1.5.0", "object-path": "^0.11.3", "phoenix": "^1.3.0", "portal-vue": "^2.1.4", - "sanitize-html": "^1.13.0", "v-click-outside": "^2.1.1", "vue": "^2.6.11", "vue-chat-scroll": "^1.2.1", @@ -39,6 +37,7 @@ "whatwg-fetch": "^2.0.3" }, "devDependencies": { + "karma-mocha-reporter": "^2.2.1", "@babel/core": "^7.7.5", "@babel/plugin-transform-runtime": "^7.7.6", "@babel/preset-env": "^7.7.6", diff --git a/src/services/status_parser/status_parser.js b/src/services/status_parser/status_parser.js index 3d517e3c..ed0f6d57 100644 --- a/src/services/status_parser/status_parser.js +++ b/src/services/status_parser/status_parser.js @@ -1,17 +1,4 @@ import { filter } from 'lodash' -import sanitize from 'sanitize-html' - -export const removeAttachmentLinks = (html) => { - return sanitize(html, { - allowedTags: false, - allowedAttributes: false, - exclusiveFilter: ({ tag, attribs }) => tag === 'a' && typeof attribs.class === 'string' && attribs.class.match(/attachment/) - }) -} - -export const parse = (html) => { - return removeAttachmentLinks(html) -} export const muteWordHits = (status, muteWords) => { const statusText = status.text.toLowerCase() @@ -22,5 +9,3 @@ export const muteWordHits = (status, muteWords) => { return hits } - -export default parse diff --git a/test/unit/specs/services/status_parser/status_parses.spec.js b/test/unit/specs/services/status_parser/status_parses.spec.js deleted file mode 100644 index 7afd5042..00000000 --- a/test/unit/specs/services/status_parser/status_parses.spec.js +++ /dev/null @@ -1,17 +0,0 @@ -import { removeAttachmentLinks } from '../../../../../src/services/status_parser/status_parser.js' - -const example = '' - -describe('statusParser.removeAttachmentLinks', () => { - const exampleWithoutAttachmentLinks = '' - - it('removes attachment links', () => { - const parsed = removeAttachmentLinks(example) - expect(parsed).to.eql(exampleWithoutAttachmentLinks) - }) - - it('works when the class is empty', () => { - const parsed = removeAttachmentLinks('') - expect(parsed).to.eql('') - }) -}) -- cgit v1.2.3-70-g09d2