diff --git a/frontend/src/Metamaps/Views/ChatView.js b/frontend/src/Metamaps/Views/ChatView.js index fd77864f..590dd775 100644 --- a/frontend/src/Metamaps/Views/ChatView.js +++ b/frontend/src/Metamaps/Views/ChatView.js @@ -3,13 +3,12 @@ import Backbone from 'backbone' import { Howl } from 'howler' import Autolinker from 'autolinker' -import _ from 'lodash' -import underscore from 'underscore' +import { clone, template as lodashTemplate } from 'lodash' import outdent from 'outdent' // TODO is this line good or bad // Backbone.$ = window.$ -const linker = new Autolinker({ newWindow: true, truncate: 50, email: false, phone: false, twitter: false }) +const linker = new Autolinker({ newWindow: true, truncate: 50, email: false, phone: false }) var Private = { messageHTML: outdent` @@ -41,12 +40,13 @@ var Private = {
`, templates: function() { - underscore.templateSettings = { + const templateSettings = { interpolate: /\{\{(.+?)\}\}/g } - this.messageTemplate = underscore.template(Private.messageHTML) - this.participantTemplate = underscore.template(Private.participantHTML) + this.messageTemplate = lodashTemplate(Private.messageHTML, templateSettings) + + this.participantTemplate = lodashTemplate(Private.participantHTML, templateSettings) }, createElements: function() { this.$unread = $('') @@ -147,7 +147,7 @@ var Private = { } return i } - var m = _.clone(message.attributes) + var m = clone(message.attributes) m.timestamp = new Date(m.created_at) @@ -176,7 +176,7 @@ var Private = { $(document).trigger(ChatView.events.message + '-' + this.room, [message]) }, addParticipant: function(participant) { - var p = _.clone(participant.attributes) + var p = clone(participant.attributes) if (p.self) { p.selfClass = 'is-self' p.selfName = '(me)' diff --git a/frontend/src/index.js b/frontend/src/index.js index 67f69141..1d82af7c 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,5 +1,5 @@ // create global references -import _ from 'underscore' +import _ from 'lodash' import Metamaps from './Metamaps' window._ = _ diff --git a/package.json b/package.json index 1edf0896..92d4ab25 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "homepage": "https://github.com/metamaps/metamaps#readme", "dependencies": { "attachmediastream": "1.4.2", - "autolinker": "0.17.1", + "autolinker": "1.4.0", "babel-cli": "6.18.0", "babel-loader": "6.2.9", "babel-plugin-lodash": "3.2.10", @@ -43,7 +43,6 @@ "redux": "3.6.0", "simplewebrtc": "2.2.1", "socket.io": "1.3.7", - "underscore": "1.4.4", "webpack": "1.14.0" }, "devDependencies": {