diff --git a/js/modules/link_text.d.ts b/js/modules/link_text.d.ts
deleted file mode 100644
index 25425ee18..000000000
--- a/js/modules/link_text.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-declare namespace LinkText {
- type Attributes = {
- [key: string]: string;
- };
-}
-
-declare function linkText(
- value: string,
- attributes: LinkText.Attributes
-): string;
-
-export = linkText;
diff --git a/js/modules/link_text.js b/js/modules/link_text.js
deleted file mode 100644
index 9114c237d..000000000
--- a/js/modules/link_text.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// Fork of https://github.com/uiureo/link-text with HTML escaping disabled as we leverage
-// jQuery’s escaping mechanism:
-
-const linkify = require('linkify-it')();
-
-function createLink(url, text, attrs = {}) {
- const html = [];
- html.push(' {
- html.push(` ${key}="${attrs[key]}"`);
- });
- html.push('>');
- html.push(decodeURIComponent(text));
- html.push('');
-
- return html.join('');
-}
-
-module.exports = (text, attrs = {}) => {
- const matchData = linkify.match(text) || [];
-
- const result = [];
- let last = 0;
-
- matchData.forEach(match => {
- if (last < match.index) {
- result.push(text.slice(last, match.index));
- }
-
- result.push(createLink(match.url, match.text, attrs));
-
- last = match.lastIndex;
- });
-
- result.push(text.slice(last));
-
- return result.join('');
-};
diff --git a/js/signal.js b/js/modules/signal.js
similarity index 50%
rename from js/signal.js
rename to js/modules/signal.js
index cdb396cd8..471dfed9e 100644
--- a/js/signal.js
+++ b/js/modules/signal.js
@@ -1,60 +1,59 @@
// The idea with this file is to make it webpackable for the style guide
-const Backbone = require('../ts/backbone');
-const Crypto = require('./modules/crypto');
-const Database = require('./modules/database');
-const Emoji = require('../ts/util/emoji');
-const HTML = require('../ts/html');
-const Message = require('./modules/types/message');
-const Notifications = require('../ts/notifications');
-const OS = require('../ts/OS');
-const Settings = require('./modules/settings');
-const Startup = require('./modules/startup');
-const Util = require('../ts/util');
+const Backbone = require('../../ts/backbone');
+const Crypto = require('./crypto');
+const Database = require('./database');
+const Emoji = require('../../ts/util/emoji');
+const Message = require('./types/message');
+const Notifications = require('../../ts/notifications');
+const OS = require('../../ts/OS');
+const Settings = require('./settings');
+const Startup = require('./startup');
+const Util = require('../../ts/util');
// Components
const {
ContactDetail,
-} = require('../ts/components/conversation/ContactDetail');
-const { ContactName } = require('../ts/components/conversation/ContactName');
+} = require('../../ts/components/conversation/ContactDetail');
+const { ContactName } = require('../../ts/components/conversation/ContactName');
const {
ConversationTitle,
-} = require('../ts/components/conversation/ConversationTitle');
+} = require('../../ts/components/conversation/ConversationTitle');
const {
EmbeddedContact,
-} = require('../ts/components/conversation/EmbeddedContact');
-const { Emojify } = require('../ts/components/conversation/Emojify');
-const { Lightbox } = require('../ts/components/Lightbox');
-const { LightboxGallery } = require('../ts/components/LightboxGallery');
+} = require('../../ts/components/conversation/EmbeddedContact');
+const { Emojify } = require('../../ts/components/conversation/Emojify');
+const { Lightbox } = require('../../ts/components/Lightbox');
+const { LightboxGallery } = require('../../ts/components/LightboxGallery');
const {
MediaGallery,
-} = require('../ts/components/conversation/media-gallery/MediaGallery');
-const { MessageBody } = require('../ts/components/conversation/MessageBody');
-const { Quote } = require('../ts/components/conversation/Quote');
+} = require('../../ts/components/conversation/media-gallery/MediaGallery');
+const { MessageBody } = require('../../ts/components/conversation/MessageBody');
+const { Quote } = require('../../ts/components/conversation/Quote');
// Migrations
const {
getPlaceholderMigrations,
-} = require('./modules/migrations/get_placeholder_migrations');
+} = require('./migrations/get_placeholder_migrations');
-const Migrations0DatabaseWithAttachmentData = require('./modules/migrations/migrations_0_database_with_attachment_data');
-const Migrations1DatabaseWithoutAttachmentData = require('./modules/migrations/migrations_1_database_without_attachment_data');
+const Migrations0DatabaseWithAttachmentData = require('./migrations/migrations_0_database_with_attachment_data');
+const Migrations1DatabaseWithoutAttachmentData = require('./migrations/migrations_1_database_without_attachment_data');
// Types
-const AttachmentType = require('./modules/types/attachment');
-const Contact = require('../ts/types/Contact');
-const Conversation = require('../ts/types/Conversation');
-const Errors = require('./modules/types/errors');
-const MediaGalleryMessage = require('../ts/components/conversation/media-gallery/types/Message');
-const MIME = require('../ts/types/MIME');
-const SettingsType = require('../ts/types/Settings');
+const AttachmentType = require('./types/attachment');
+const Contact = require('../../ts/types/Contact');
+const Conversation = require('../../ts/types/Conversation');
+const Errors = require('./types/errors');
+const MediaGalleryMessage = require('../../ts/components/conversation/media-gallery/types/Message');
+const MIME = require('../../ts/types/MIME');
+const SettingsType = require('../../ts/types/Settings');
// Views
-const Initialization = require('./modules/views/initialization');
+const Initialization = require('./views/initialization');
// Workflow
-const { IdleDetector } = require('./modules/idle_detector');
-const MessageDataMigrator = require('./modules/messages_data_migrator');
+const { IdleDetector } = require('./idle_detector');
+const MessageDataMigrator = require('./messages_data_migrator');
exports.setup = (options = {}) => {
const { Attachments, userDataPath, getRegionCode } = options;
@@ -127,7 +126,6 @@ exports.setup = (options = {}) => {
Crypto,
Database,
Emoji,
- HTML,
Migrations,
Notifications,
OS,
diff --git a/preload.js b/preload.js
index 19bde4a46..286818a33 100644
--- a/preload.js
+++ b/preload.js
@@ -113,7 +113,7 @@ window.React = require('react');
window.ReactDOM = require('react-dom');
window.moment = require('moment');
-const Signal = require('./js/signal');
+const Signal = require('./js/modules/signal');
const i18n = require('./js/modules/i18n');
const Attachments = require('./app/attachments');
diff --git a/ts/html/index.ts b/ts/html/index.ts
deleted file mode 100644
index bf1b95408..000000000
--- a/ts/html/index.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-// tslint:disable-next-line: match-default-export-name
-import linkTextInternal from '../../js/modules/link_text';
-
-export const linkText = (value: string): string =>
- linkTextInternal(value, { target: '_blank' });
-
-export const replaceLineBreaks = (value: string): string =>
- value.replace(/\r?\n/g, '
');
-
-// NOTE: How can we use `lodash/fp` `compose` with type checking?
-export const render = (value: string): string =>
- replaceLineBreaks(linkText(value));
diff --git a/ts/styleguide/StyleGuideUtil.ts b/ts/styleguide/StyleGuideUtil.ts
index 511b55fe6..8e645dac8 100644
--- a/ts/styleguide/StyleGuideUtil.ts
+++ b/ts/styleguide/StyleGuideUtil.ts
@@ -15,7 +15,7 @@ export { ConversationContext } from './ConversationContext';
export { BackboneWrapper } from '../components/utility/BackboneWrapper';
// @ts-ignore
-import * as Signal from '../../js/signal';
+import * as Signal from '../../js/modules/signal';
import { SignalService } from '../protobuf';
// TypeScript wants two things when you import:
diff --git a/ts/test/html/index_test.ts b/ts/test/html/index_test.ts
deleted file mode 100644
index cefd9469a..000000000
--- a/ts/test/html/index_test.ts
+++ /dev/null
@@ -1,96 +0,0 @@
-import { assert } from 'chai';
-
-import * as HTML from '../../html';
-
-interface Test {
- input: string;
- name: string;
- output?: string;
- outputHref?: string;
- outputLabel?: string;
- postText?: string;
- preText?: string;
- skipped?: boolean;
-}
-
-describe('HTML', () => {
- describe('linkText', () => {
- const TESTS: Array = [
- {
- name: 'square brackets',
- input: 'https://www.example.com/test.html?foo=bar&baz[qux]=quux',
- output: 'https://www.example.com/test.html?foo=bar&baz[qux]=quux',
- },
- {
- name: 'Chinese characters',
- input: 'https://zh.wikipedia.org/zh-hans/信号',
- output: 'https://zh.wikipedia.org/zh-hans/信号',
- },
- {
- name: 'Cyrillic characters',
- input: 'https://ru.wikipedia.org/wiki/Сигнал',
- output: 'https://ru.wikipedia.org/wiki/Сигнал',
- },
- {
- skipped: true,
- name: 'trailing exclamation points',
- input: 'https://en.wikipedia.org/wiki/Mother!',
- output: 'https://en.wikipedia.org/wiki/Mother!',
- },
- {
- name: 'single quotes',
- input: "https://www.example.com/this-couldn't-be-true",
- output: "https://www.example.com/this-couldn't-be-true",
- },
- {
- name: 'special characters before URL begins',
- preText: 'wink ;)',
- input: 'https://www.youtube.com/watch?v=oHg5SJYRHA0',
- output: 'https://www.youtube.com/watch?v=oHg5SJYRHA0',
- },
- {
- name: 'URLs without protocols',
- input: 'github.com',
- // tslint:disable-next-line:no-http-string
- outputHref: 'http://github.com',
- outputLabel: 'github.com',
- },
- ];
-
- TESTS.forEach(test => {
- (test.skipped ? it.skip : it)(`should handle ${test.name}`, () => {
- const preText = test.preText || 'Hello ';
- const postText = test.postText || ' World!';
- const input: string = `${preText}${test.input}${postText}`;
- const expected: string = [
- preText,
- ``,
- test.outputLabel || test.output,
- '',
- postText,
- ].join('');
-
- const actual = HTML.linkText(input);
- assert.equal(actual, expected);
- });
- });
- });
-
- describe('render', () => {
- it('should preserve line breaks', () => {
- const input: string = 'Hello\n\n\nWorld!';
- const expected: string = 'Hello
World!';
-
- const actual = HTML.render(input);
- assert.equal(actual, expected);
- });
-
- it('should not escape HTML', () => {
- const input: string = "Hello\nWorld!";
- const expected: string = "Hello
World!";
-
- const actual = HTML.render(input);
- assert.equal(actual, expected);
- });
- });
-});