DEV: Replace `$.extend` with `Object.assign` (#14921)
This commit is contained in:
parent
4938381b78
commit
4f14e012a7
|
@ -258,8 +258,9 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
let params = this.get("selected.is_custom_flag")
|
let params = this.get("selected.is_custom_flag")
|
||||||
? { message: this.message }
|
? { message: this.message }
|
||||||
: {};
|
: {};
|
||||||
|
|
||||||
if (opts) {
|
if (opts) {
|
||||||
params = $.extend(params, opts);
|
params = Object.assign(params, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.appEvents.trigger(
|
this.appEvents.trigger(
|
||||||
|
|
|
@ -94,11 +94,14 @@ export default Mixin.create({
|
||||||
const isValid = validateUploadedFiles(data.files, opts);
|
const isValid = validateUploadedFiles(data.files, opts);
|
||||||
const type = this.type;
|
const type = this.type;
|
||||||
let form = type ? { type } : {};
|
let form = type ? { type } : {};
|
||||||
|
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
form = $.extend(form, this.data);
|
form = Object.assign(form, this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.formData = form;
|
data.formData = form;
|
||||||
this.setProperties({ uploadProgress: 0, uploading: isValid });
|
this.setProperties({ uploadProgress: 0, uploading: isValid });
|
||||||
|
|
||||||
return isValid;
|
return isValid;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ export default DiscourseRoute.extend(FilterModeMixin, {
|
||||||
const categoryId = controller.get("category.id");
|
const categoryId = controller.get("category.id");
|
||||||
|
|
||||||
if (categoryId) {
|
if (categoryId) {
|
||||||
options = $.extend({}, options, {
|
options = Object.assign({}, options, {
|
||||||
categoryId,
|
categoryId,
|
||||||
includeSubcategories: !controller.noSubcategories,
|
includeSubcategories: !controller.noSubcategories,
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ export default EmberObject.extend({
|
||||||
},
|
},
|
||||||
set(value, searchContext) {
|
set(value, searchContext) {
|
||||||
// a bit hacky, consider cleaning this up, need to work through all observers though
|
// a bit hacky, consider cleaning this up, need to work through all observers though
|
||||||
const context = $.extend({}, searchContext);
|
const context = Object.assign({}, searchContext);
|
||||||
context.type = value;
|
context.type = value;
|
||||||
this.set("searchContext", context);
|
this.set("searchContext", context);
|
||||||
return this.get("searchContext.type");
|
return this.get("searchContext.type");
|
||||||
|
|
|
@ -402,7 +402,7 @@ export default createWidget("header", {
|
||||||
let contentsAttrs = { contents, minimized: !!attrs.topic };
|
let contentsAttrs = { contents, minimized: !!attrs.topic };
|
||||||
return h(
|
return h(
|
||||||
"div.wrap",
|
"div.wrap",
|
||||||
this.attach("header-contents", $.extend({}, attrs, contentsAttrs))
|
this.attach("header-contents", Object.assign({}, attrs, contentsAttrs))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,11 @@ export function withFrozenTime(timeString, timezone, callback) {
|
||||||
let _pretenderCallbacks = {};
|
let _pretenderCallbacks = {};
|
||||||
|
|
||||||
export function resetSite(siteSettings, extras) {
|
export function resetSite(siteSettings, extras) {
|
||||||
let siteAttrs = $.extend({}, siteFixtures["site.json"].site, extras || {});
|
let siteAttrs = Object.assign(
|
||||||
|
{},
|
||||||
|
siteFixtures["site.json"].site,
|
||||||
|
extras || {}
|
||||||
|
);
|
||||||
siteAttrs.store = createStore();
|
siteAttrs.store = createStore();
|
||||||
siteAttrs.siteSettings = siteSettings;
|
siteAttrs.siteSettings = siteSettings;
|
||||||
return Site.resetCurrent(Site.create(siteAttrs));
|
return Site.resetCurrent(Site.create(siteAttrs));
|
||||||
|
|
|
@ -42,7 +42,7 @@ function AcceptanceModal(option, _relatedTarget) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
let $this = $(this);
|
let $this = $(this);
|
||||||
let data = $this.data("bs.modal");
|
let data = $this.data("bs.modal");
|
||||||
let options = $.extend(
|
let options = Object.assign(
|
||||||
{},
|
{},
|
||||||
Modal.DEFAULTS,
|
Modal.DEFAULTS,
|
||||||
$this.data(),
|
$this.data(),
|
||||||
|
|
|
@ -162,10 +162,10 @@ export default function initLazyYt($) {
|
||||||
$.fn.lazyYT = function (newSettings) {
|
$.fn.lazyYT = function (newSettings) {
|
||||||
let defaultSettings = {
|
let defaultSettings = {
|
||||||
default_ratio: "16:9",
|
default_ratio: "16:9",
|
||||||
callback: null, // ToDO execute callback if given
|
callback: null, // TODO: execute callback if given
|
||||||
container_class: "lazyYT-container",
|
container_class: "lazyYT-container",
|
||||||
};
|
};
|
||||||
let settings = $.extend(defaultSettings, newSettings);
|
let settings = Object.assign(defaultSettings, newSettings);
|
||||||
|
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
let $el = $(this).addClass(settings.container_class);
|
let $el = $(this).addClass(settings.container_class);
|
||||||
|
|
|
@ -89,7 +89,7 @@ export function createData(store) {
|
||||||
topicId++;
|
topicId++;
|
||||||
return store.createRecord(
|
return store.createRecord(
|
||||||
"topic",
|
"topic",
|
||||||
$.extend(
|
Object.assign(
|
||||||
{
|
{
|
||||||
id: topicId,
|
id: topicId,
|
||||||
title: `Example Topic Title ${topicId}`,
|
title: `Example Topic Title ${topicId}`,
|
||||||
|
|
Loading…
Reference in New Issue