SECURITY: updates lodash from 1.3.0 to 4.17.5 (#7546)
This commit is contained in:
parent
cabc203885
commit
d47bf8b6c4
|
@ -45,7 +45,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
||||||
changed(name) {
|
changed(name) {
|
||||||
if (!this.originals) return false;
|
if (!this.originals) return false;
|
||||||
if (this.originals.name !== name) return true;
|
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;
|
return false;
|
||||||
},
|
},
|
||||||
|
@ -56,7 +56,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
||||||
return false;
|
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"),
|
newRecord: Ember.computed.not("id"),
|
||||||
|
|
|
@ -138,7 +138,7 @@ const Theme = RestModel.extend({
|
||||||
@computed("theme_fields", "theme_fields.@each.error")
|
@computed("theme_fields", "theme_fields.@each.error")
|
||||||
isBroken(fields) {
|
isBroken(fields) {
|
||||||
return (
|
return (
|
||||||
fields && fields.some(field => field.error && field.error.length > 0)
|
fields && fields.any(field => field.error && field.error.length > 0)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
//= require ./discourse/lib/lock-on
|
//= require ./discourse/lib/lock-on
|
||||||
//= require ./discourse/lib/url
|
//= require ./discourse/lib/url
|
||||||
//= require ./discourse/lib/debounce
|
//= require ./discourse/lib/debounce
|
||||||
|
//= require ./discourse/lib/throttle
|
||||||
//= require ./discourse/lib/quote
|
//= require ./discourse/lib/quote
|
||||||
//= require ./discourse/lib/key-value-store
|
//= require ./discourse/lib/key-value-store
|
||||||
//= require ./discourse/lib/computed
|
//= require ./discourse/lib/computed
|
||||||
|
@ -53,7 +54,6 @@
|
||||||
//= require ./discourse/lib/export-csv
|
//= require ./discourse/lib/export-csv
|
||||||
//= require ./discourse/lib/autocomplete
|
//= require ./discourse/lib/autocomplete
|
||||||
//= require ./discourse/lib/after-transition
|
//= require ./discourse/lib/after-transition
|
||||||
//= require ./discourse/lib/debounce
|
|
||||||
//= require ./discourse/lib/safari-hacks
|
//= require ./discourse/lib/safari-hacks
|
||||||
//= require_tree ./discourse/adapters
|
//= require_tree ./discourse/adapters
|
||||||
//= require ./discourse/models/post-action-type
|
//= require ./discourse/models/post-action-type
|
||||||
|
|
|
@ -598,7 +598,7 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_scrollTo(y) {
|
_scrollTo(y) {
|
||||||
const yPosition = _.isUndefined(y) ? this.scrollPosition : y;
|
const yPosition = typeof y === "undefined" ? this.scrollPosition : y;
|
||||||
|
|
||||||
this.$list.scrollTop(yPosition);
|
this.$list.scrollTop(yPosition);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import debounce from "discourse/lib/debounce";
|
||||||
import { selectedText } from "discourse/lib/utilities";
|
import { selectedText } from "discourse/lib/utilities";
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
|
@ -122,7 +123,7 @@ export default Ember.Component.extend({
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
const { isWinphone, isAndroid } = this.capabilities;
|
const { isWinphone, isAndroid } = this.capabilities;
|
||||||
const wait = isWinphone || isAndroid ? 250 : 25;
|
const wait = isWinphone || isAndroid ? 250 : 25;
|
||||||
const onSelectionChanged = _.debounce(() => this._selectionChanged(), wait);
|
const onSelectionChanged = debounce(() => this._selectionChanged(), wait);
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on("mousedown.quote-button", e => {
|
.on("mousedown.quote-button", e => {
|
||||||
|
|
|
@ -53,7 +53,7 @@ export default Ember.Component.extend(
|
||||||
if (categoryId) {
|
if (categoryId) {
|
||||||
const category = Category.findById(categoryId);
|
const category = Category.findById(categoryId);
|
||||||
|
|
||||||
options = _.assign(
|
options = Object.assign(
|
||||||
{
|
{
|
||||||
categoryName: category.get("slug"),
|
categoryName: category.get("slug"),
|
||||||
categoryUrl: category.get("url")
|
categoryUrl: category.get("url")
|
||||||
|
|
|
@ -67,7 +67,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
this.set("topicActionByName", lookup);
|
this.set("topicActionByName", lookup);
|
||||||
|
|
||||||
return this.site.get("topic_flag_types").filter(item => {
|
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;
|
return a.id === item.get("id") && a.can_act;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -112,7 +112,11 @@ export default Ember.Controller.extend(PreferencesTabController, {
|
||||||
|
|
||||||
@computed()
|
@computed()
|
||||||
userSelectableHome() {
|
userSelectableHome() {
|
||||||
let homeValues = _.invert(USER_HOMES);
|
let homeValues = {};
|
||||||
|
Object.keys(USER_HOMES).forEach(newValue => {
|
||||||
|
const newKey = USER_HOMES[newValue];
|
||||||
|
homeValues[newKey] = newValue;
|
||||||
|
});
|
||||||
|
|
||||||
let result = [];
|
let result = [];
|
||||||
this.siteSettings.top_menu.split("|").forEach(m => {
|
this.siteSettings.top_menu.split("|").forEach(m => {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import debounce from "discourse/lib/debounce";
|
||||||
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
||||||
import Category from "discourse/models/category";
|
import Category from "discourse/models/category";
|
||||||
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
|
||||||
|
@ -19,7 +20,7 @@ function searchTags(term, categories, limit) {
|
||||||
resolve(CANCELLED_STATUS);
|
resolve(CANCELLED_STATUS);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
const debouncedSearch = _.debounce((q, cats, resultFunc) => {
|
const debouncedSearch = debounce((q, cats, resultFunc) => {
|
||||||
oldSearch = $.ajax(Discourse.getURL("/tags/filter/search"), {
|
oldSearch = $.ajax(Discourse.getURL("/tags/filter/search"), {
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: true,
|
cache: true,
|
||||||
|
|
|
@ -104,7 +104,7 @@ export function endWith() {
|
||||||
const substring = args.pop();
|
const substring = args.pop();
|
||||||
const computed = Ember.computed(function() {
|
const computed = Ember.computed(function() {
|
||||||
const self = this;
|
const self = this;
|
||||||
return _.all(
|
return _.every(
|
||||||
args.map(function(a) {
|
args.map(function(a) {
|
||||||
return self.get(a);
|
return self.get(a);
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -410,13 +410,13 @@ export default {
|
||||||
|
|
||||||
_globalBindToFunction(func, binding) {
|
_globalBindToFunction(func, binding) {
|
||||||
if (typeof this[func] === "function") {
|
if (typeof this[func] === "function") {
|
||||||
this.keyTrapper.bindGlobal(binding, _.bind(this[func], this));
|
this.keyTrapper.bindGlobal(binding, this[func].bind(this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_bindToFunction(func, binding) {
|
_bindToFunction(func, binding) {
|
||||||
if (typeof this[func] === "function") {
|
if (typeof this[func] === "function") {
|
||||||
this.keyTrapper.bind(binding, _.bind(this[func], this));
|
this.keyTrapper.bind(binding, this[func].bind(this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import debounce from "discourse/lib/debounce";
|
||||||
import { isAppleDevice, safariHacksDisabled } from "discourse/lib/utilities";
|
import { isAppleDevice, safariHacksDisabled } from "discourse/lib/utilities";
|
||||||
|
|
||||||
// we can't tell what the actual visible window height is
|
// we can't tell what the actual visible window height is
|
||||||
|
@ -106,7 +107,7 @@ function positioningWorkaround($fixedElement) {
|
||||||
positioningWorkaround.blur(evt);
|
positioningWorkaround.blur(evt);
|
||||||
};
|
};
|
||||||
|
|
||||||
var blurred = _.debounce(blurredNow, 250);
|
var blurred = debounce(blurredNow, 250);
|
||||||
|
|
||||||
var positioningHack = function(evt) {
|
var positioningHack = function(evt) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
@ -161,7 +162,7 @@ function positioningWorkaround($fixedElement) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkForInputs = _.debounce(function() {
|
const checkForInputs = debounce(function() {
|
||||||
$fixedElement
|
$fixedElement
|
||||||
.find(
|
.find(
|
||||||
"button:not(.hide-preview),a:not(.mobile-file-upload):not(.toggle-toolbar)"
|
"button:not(.hide-preview),a:not(.mobile-file-upload):not(.toggle-toolbar)"
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/**
|
||||||
|
Throttle a Javascript function. This means if it's called many times in a time limit it
|
||||||
|
should only be executed one time at most during this time limit
|
||||||
|
Original function will be called with the context and arguments from the last call made.
|
||||||
|
**/
|
||||||
|
export default function(func, spacing, immediate) {
|
||||||
|
let self, args;
|
||||||
|
const later = function() {
|
||||||
|
func.apply(self, args);
|
||||||
|
};
|
||||||
|
|
||||||
|
return function() {
|
||||||
|
self = this;
|
||||||
|
args = arguments;
|
||||||
|
|
||||||
|
Ember.run.throttle(null, later, spacing, immediate);
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
import debounce from "discourse/lib/debounce";
|
||||||
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
import { emailValid } from "discourse/lib/utilities";
|
import { emailValid } from "discourse/lib/utilities";
|
||||||
|
@ -61,7 +62,7 @@ function performSearch(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var debouncedSearch = _.debounce(performSearch, 300);
|
var debouncedSearch = debounce(performSearch, 300);
|
||||||
|
|
||||||
function organizeResults(r, options) {
|
function organizeResults(r, options) {
|
||||||
if (r === CANCELLED_STATUS) {
|
if (r === CANCELLED_STATUS) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
} from "ember-addons/ember-computed-decorators";
|
} from "ember-addons/ember-computed-decorators";
|
||||||
import { escapeExpression, tinyAvatar } from "discourse/lib/utilities";
|
import { escapeExpression, tinyAvatar } from "discourse/lib/utilities";
|
||||||
import { propertyNotEqual } from "discourse/lib/computed";
|
import { propertyNotEqual } from "discourse/lib/computed";
|
||||||
|
import throttle from "discourse/lib/throttle";
|
||||||
|
|
||||||
// The actions the composer can take
|
// The actions the composer can take
|
||||||
export const CREATE_TOPIC = "createTopic",
|
export const CREATE_TOPIC = "createTopic",
|
||||||
|
@ -200,13 +201,13 @@ const Composer = RestModel.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
// view detected user is typing
|
// view detected user is typing
|
||||||
typing: _.throttle(
|
typing: throttle(
|
||||||
function() {
|
function() {
|
||||||
const typingTime = this.typingTime || 0;
|
const typingTime = this.typingTime || 0;
|
||||||
this.set("typingTime", typingTime + 100);
|
this.set("typingTime", typingTime + 100);
|
||||||
},
|
},
|
||||||
100,
|
100,
|
||||||
{ leading: false, trailing: true }
|
false
|
||||||
),
|
),
|
||||||
|
|
||||||
editingFirstPost: Ember.computed.and("editingPost", "post.firstPost"),
|
editingFirstPost: Ember.computed.and("editingPost", "post.firstPost"),
|
||||||
|
|
|
@ -337,8 +337,8 @@ const TopicTrackingState = Discourse.Model.extend({
|
||||||
|
|
||||||
countNew(category_id) {
|
countNew(category_id) {
|
||||||
return _.chain(this.states)
|
return _.chain(this.states)
|
||||||
.where(isNew)
|
.filter(isNew)
|
||||||
.where(
|
.filter(
|
||||||
topic =>
|
topic =>
|
||||||
topic.archetype !== "private_message" &&
|
topic.archetype !== "private_message" &&
|
||||||
!topic.deleted &&
|
!topic.deleted &&
|
||||||
|
@ -359,8 +359,8 @@ const TopicTrackingState = Discourse.Model.extend({
|
||||||
|
|
||||||
countUnread(category_id) {
|
countUnread(category_id) {
|
||||||
return _.chain(this.states)
|
return _.chain(this.states)
|
||||||
.where(isUnread)
|
.filter(isUnread)
|
||||||
.where(
|
.filter(
|
||||||
topic =>
|
topic =>
|
||||||
topic.archetype !== "private_message" &&
|
topic.archetype !== "private_message" &&
|
||||||
!topic.deleted &&
|
!topic.deleted &&
|
||||||
|
|
|
@ -68,7 +68,7 @@ export default RestModel.extend({
|
||||||
|
|
||||||
// 2) remove the parents that have no children
|
// 2) remove the parents that have no children
|
||||||
const content = this.content.filter(ua => {
|
const content = this.content.filter(ua => {
|
||||||
return ["likes", "stars", "edits", "bookmarks"].any(group => {
|
return ["likes", "stars", "edits", "bookmarks"].some(group => {
|
||||||
return ua.get(`childGroups.${group}.items.length`) > 0;
|
return ua.get(`childGroups.${group}.items.length`) > 0;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,10 +39,7 @@ export default createWidget("post-links", {
|
||||||
}
|
}
|
||||||
|
|
||||||
// only show incoming
|
// only show incoming
|
||||||
const links = _(this.attrs.links)
|
const links = this.attrs.links.filter(l => l.reflection).uniqBy("title");
|
||||||
.filter(l => l.reflection)
|
|
||||||
.uniq(true, l => l.title)
|
|
||||||
.value();
|
|
||||||
|
|
||||||
if (links.length === 0) {
|
if (links.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,9 +9,9 @@ QUnit.module("lib:keyboard-shortcuts", {
|
||||||
|
|
||||||
testMouseTrap = {
|
testMouseTrap = {
|
||||||
bind: function(bindings, callback) {
|
bind: function(bindings, callback) {
|
||||||
var registerBinding = _.bind(function(binding) {
|
var registerBinding = function(binding) {
|
||||||
_bindings[binding] = callback;
|
_bindings[binding] = callback;
|
||||||
}, this);
|
}.bind(this);
|
||||||
|
|
||||||
if (_.isArray(bindings)) {
|
if (_.isArray(bindings)) {
|
||||||
bindings.forEach(registerBinding, this);
|
bindings.forEach(registerBinding, this);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue