SECURITY: updates lodash from 1.3.0 to 4.17.5 (#7546)

SECURITY: updates lodash from 1.3.0 to 4.17.5 (#7546)

diff --git a/app/assets/javascripts/admin/models/color-scheme.js.es6 b/app/assets/javascripts/admin/models/color-scheme.js.es6
index baf0d8c..5276ef8 100644
--- a/app/assets/javascripts/admin/models/color-scheme.js.es6
+++ b/app/assets/javascripts/admin/models/color-scheme.js.es6
@@ -45,7 +45,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
   changed(name) {
     if (!this.originals) return false;
     if (this.originals.name !== name) return true;
-    if (_.any(this.colors, c => c.get("changed"))) return true;
+    if (this.colors.any(c => c.get("changed"))) return true;
 
     return false;
   },
@@ -56,7 +56,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
       return false;
     }
 
-    return !changed || this.saving || _.any(this.colors, c => !c.get("valid"));
+    return !changed || this.saving || this.colors.any(c => !c.get("valid"));
   },
 
   newRecord: Ember.computed.not("id"),
diff --git a/app/assets/javascripts/admin/models/theme.js.es6 b/app/assets/javascripts/admin/models/theme.js.es6
index 1de1a6a..0439321 100644
--- a/app/assets/javascripts/admin/models/theme.js.es6
+++ b/app/assets/javascripts/admin/models/theme.js.es6
@@ -138,7 +138,7 @@ const Theme = RestModel.extend({
   @computed("theme_fields", "theme_fields.@each.error")
   isBroken(fields) {
     return (
-      fields && fields.some(field => field.error && field.error.length > 0)
+      fields && fields.any(field => field.error && field.error.length > 0)
     );
   },
 
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 81e09b2..180df64 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -24,6 +24,7 @@
 //= require ./discourse/lib/lock-on
 //= require ./discourse/lib/url
 //= require ./discourse/lib/debounce
+//= require ./discourse/lib/throttle
 //= require ./discourse/lib/quote
 //= require ./discourse/lib/key-value-store
 //= require ./discourse/lib/computed
@@ -53,7 +54,6 @@
 //= require ./discourse/lib/export-csv
 //= require ./discourse/lib/autocomplete
 //= require ./discourse/lib/after-transition
-//= require ./discourse/lib/debounce
 //= require ./discourse/lib/safari-hacks
 //= require_tree ./discourse/adapters
 //= require ./discourse/models/post-action-type
diff --git a/app/assets/javascripts/discourse/components/emoji-picker.js.es6 b/app/assets/javascripts/discourse/components/emoji-picker.js.es6
index 1f949d8..7ea07b9 100644
--- a/app/assets/javascripts/discourse/components/emoji-picker.js.es6
+++ b/app/assets/javascripts/discourse/components/emoji-picker.js.es6
@@ -598,7 +598,7 @@ export default Ember.Component.extend({
   },
 
   _scrollTo(y) {
-    const yPosition = _.isUndefined(y) ? this.scrollPosition : y;
+    const yPosition = typeof y === "undefined" ? this.scrollPosition : y;
 
     this.$list.scrollTop(yPosition);
 
diff --git a/app/assets/javascripts/discourse/components/quote-button.js.es6 b/app/assets/javascripts/discourse/components/quote-button.js.es6
index b26f891..2db8583 100644
--- a/app/assets/javascripts/discourse/components/quote-button.js.es6
+++ b/app/assets/javascripts/discourse/components/quote-button.js.es6
@@ -1,3 +1,4 @@
+import debounce from "discourse/lib/debounce";
 import { selectedText } from "discourse/lib/utilities";
 
 export default Ember.Component.extend({
@@ -122,7 +123,7 @@ export default Ember.Component.extend({
   didInsertElement() {
     const { isWinphone, isAndroid } = this.capabilities;
     const wait = isWinphone || isAndroid ? 250 : 25;
-    const onSelectionChanged = _.debounce(() => this._selectionChanged(), wait);
+    const onSelectionChanged = debounce(() => this._selectionChanged(), wait);
 
     $(document)
       .on("mousedown.quote-button", e => {
diff --git a/app/assets/javascripts/discourse/components/topic-timer-info.js.es6 b/app/assets/javascripts/discourse/components/topic-timer-info.js.es6
index 5ef9ad7..fed1d14 100644
--- a/app/assets/javascripts/discourse/components/topic-timer-info.js.es6
+++ b/app/assets/javascripts/discourse/components/topic-timer-info.js.es6
@@ -53,7 +53,7 @@ export default Ember.Component.extend(
       if (categoryId) {
         const category = Category.findById(categoryId);
 
-        options = _.assign(
+        options = Object.assign(
           {
             categoryName: category.get("slug"),
             categoryUrl: category.get("url")
diff --git a/app/assets/javascripts/discourse/controllers/flag.js.es6 b/app/assets/javascripts/discourse/controllers/flag.js.es6
index 2c0fd77..8871974 100644
--- a/app/assets/javascripts/discourse/controllers/flag.js.es6
+++ b/app/assets/javascripts/discourse/controllers/flag.js.es6
@@ -67,7 +67,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
       this.set("topicActionByName", lookup);
 
       return this.site.get("topic_flag_types").filter(item => {
-        return _.any(this.get("model.actions_summary"), a => {
+        return this.get("model.actions_summary").some(a => {
           return a.id === item.get("id") && a.can_act;
         });
       });
diff --git a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6
index ed36721..f0ed39f 100644
--- a/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences/interface.js.es6
@@ -112,7 +112,11 @@ export default Ember.Controller.extend(PreferencesTabController, {
 
   @computed()
   userSelectableHome() {
-    let homeValues = _.invert(USER_HOMES);
+    let homeValues = {};
+    Object.keys(USER_HOMES).forEach(newValue => {
+      const newKey = USER_HOMES[newValue];
+      homeValues[newKey] = newValue;
+    });
 
     let result = [];
     this.siteSettings.top_menu.split("|").forEach(m => {
diff --git a/app/assets/javascripts/discourse/lib/category-tag-search.js.es6 b/app/assets/javascripts/discourse/lib/category-tag-search.js.es6
index 1b9ce64..164839f 100644
--- a/app/assets/javascripts/discourse/lib/category-tag-search.js.es6
+++ b/app/assets/javascripts/discourse/lib/category-tag-search.js.es6
@@ -1,3 +1,4 @@
+import debounce from "discourse/lib/debounce";
 import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
 import Category from "discourse/models/category";
 import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
@@ -19,7 +20,7 @@ function searchTags(term, categories, limit) {
       resolve(CANCELLED_STATUS);
     }, 5000);
 
-    const debouncedSearch = _.debounce((q, cats, resultFunc) => {
+    const debouncedSearch = debounce((q, cats, resultFunc) => {
       oldSearch = $.ajax(Discourse.getURL("/tags/filter/search"), {
         type: "GET",
         cache: true,
diff --git a/app/assets/javascripts/discourse/lib/computed.js.es6 b/app/assets/javascripts/discourse/lib/computed.js.es6
index 52788dd..c97c0d0 100644
--- a/app/assets/javascripts/discourse/lib/computed.js.es6
+++ b/app/assets/javascripts/discourse/lib/computed.js.es6
@@ -104,7 +104,7 @@ export function endWith() {
   const substring = args.pop();
   const computed = Ember.computed(function() {
     const self = this;
-    return _.all(
+    return _.every(
       args.map(function(a) {
         return self.get(a);
       }),
diff --git a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6
index 000cc33..590f916 100644
--- a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6
+++ b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6
@@ -410,13 +410,13 @@ export default {
 
   _globalBindToFunction(func, binding) {
     if (typeof this[func] === "function") {
-      this.keyTrapper.bindGlobal(binding, _.bind(this[func], this));
+      this.keyTrapper.bindGlobal(binding, this[func].bind(this));
     }
   },
 
   _bindToFunction(func, binding) {
     if (typeof this[func] === "function") {

[... diff too long, it was truncated ...]

GitHub sha: d47bf8b6

1 Like