+
{this.renderFeaturedMedia()}
diff --git a/imports/plugins/core/ui/client/components/numericInput/numericInput.js b/imports/plugins/core/ui/client/components/numericInput/numericInput.js
index 83f1fc6b8ef..386a051e444 100644
--- a/imports/plugins/core/ui/client/components/numericInput/numericInput.js
+++ b/imports/plugins/core/ui/client/components/numericInput/numericInput.js
@@ -110,7 +110,7 @@ class NumericInput extends Component {
let numberValue = this.unformat(value);
if (this.props.format.scale === 0) {
- numberValue = numberValue / 100;
+ numberValue /= 100;
}
this.setState({
diff --git a/imports/plugins/core/ui/client/components/table/sortableTableComponents/filter.js b/imports/plugins/core/ui/client/components/table/sortableTableComponents/filter.js
index a782b43d6ad..86b8d4c0bf3 100644
--- a/imports/plugins/core/ui/client/components/table/sortableTableComponents/filter.js
+++ b/imports/plugins/core/ui/client/components/table/sortableTableComponents/filter.js
@@ -4,11 +4,6 @@ import { TextField } from "@reactioncommerce/reaction-ui";
class SortableTableFilter extends Component {
- constructor(props) {
- super(props);
- }
-
-
render() {
return (
React ... }}` missing " +
- "`component` argument.");
+ throw new Error(`In template ${parentTemplate}, call to \`{{> React ... }}\` missing \`component\` argument.`);
}
const props = _.omit(data, "component");
diff --git a/imports/plugins/included/analytics/client/startup.js b/imports/plugins/included/analytics/client/startup.js
index de8ba5d1c1b..30eb72a7520 100644
--- a/imports/plugins/included/analytics/client/startup.js
+++ b/imports/plugins/included/analytics/client/startup.js
@@ -69,8 +69,7 @@ function loadGoogleAnalyticsScript() {
// for it to load to actually record data. The `method` is
// stored as the first argument, so we can replay the data.
analytics.factory = function (method) {
- return function () {
- const args = Array.prototype.slice.call(arguments);
+ return function (...args) {
args.unshift(method);
analytics.push(args);
return analytics;
@@ -86,8 +85,8 @@ for (let i = 0; i < analytics.methods.length; i += 1) {
// Define a method to load Analytics.js from our CDN,
// and that will be sure to only ever load it once.
analytics.load = function (key) {
- buildScript((document.location.protocol === "https:" ? "https://" : "http://") +
- "cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js");
+ const protocol = document.location.protocol === "https:" ? "https://" : "http://";
+ buildScript(`${protocol}cdn.segment.com/analytics.js/v1/${key}/analytics.min.js`);
};
// Add a version to keep track of what"s in the wild.
diff --git a/imports/plugins/included/connectors-shopify/server/hooks/orders.js b/imports/plugins/included/connectors-shopify/server/hooks/orders.js
index f706c28785d..b8571768013 100644
--- a/imports/plugins/included/connectors-shopify/server/hooks/orders.js
+++ b/imports/plugins/included/connectors-shopify/server/hooks/orders.js
@@ -21,7 +21,7 @@ Orders.after.insert((userId, doc) => {
const shopIdsInCart = doc.items.map((item) => item.shopId);
// get the unique set of shopIds in this cart
- const uniqueShopIds = [... new Set(shopIdsInCart)];
+ const uniqueShopIds = [...new Set(shopIdsInCart)];
// For each shopid check to see if there are synchooks are respond appropriately
uniqueShopIds.forEach((shopId) => {
diff --git a/imports/plugins/included/connectors-shopify/server/methods/import/customers.js b/imports/plugins/included/connectors-shopify/server/methods/import/customers.js
index 4731d2e7b82..bcb725b25c3 100644
--- a/imports/plugins/included/connectors-shopify/server/methods/import/customers.js
+++ b/imports/plugins/included/connectors-shopify/server/methods/import/customers.js
@@ -148,7 +148,7 @@ export const methods = {
const opts = Object.assign({}, {
published_status: "published",
limit
- }, { ... options });
+ }, { ...options });
try {
const customerCount = await shopify.customer.count();
diff --git a/imports/plugins/included/connectors-shopify/server/methods/import/products.js b/imports/plugins/included/connectors-shopify/server/methods/import/products.js
index a32df73bf70..6b1e3311466 100644
--- a/imports/plugins/included/connectors-shopify/server/methods/import/products.js
+++ b/imports/plugins/included/connectors-shopify/server/methods/import/products.js
@@ -263,7 +263,7 @@ export const methods = {
const opts = Object.assign({}, {
published_status: "published",
limit
- }, { ... options });
+ }, { ...options });
try {
const productCount = await shopify.product.count();
diff --git a/imports/plugins/included/connectors-shopify/server/methods/sync/hooks.js b/imports/plugins/included/connectors-shopify/server/methods/sync/hooks.js
index ab1f185cfff..855bce6244a 100644
--- a/imports/plugins/included/connectors-shopify/server/methods/sync/hooks.js
+++ b/imports/plugins/included/connectors-shopify/server/methods/sync/hooks.js
@@ -49,8 +49,7 @@ export const methods = {
const hookSetting = { topic, event, syncType };
return Packages.update(
{ name: "reaction-connectors-shopify", shopId: Reaction.getShopId() },
- { $pull: { "settings.synchooks": hookSetting }
- }
+ { $pull: { "settings.synchooks": hookSetting } }
);
}
};
diff --git a/imports/plugins/included/default-theme/client/favicons.js b/imports/plugins/included/default-theme/client/favicons.js
index 3b8a59ca434..49636806215 100644
--- a/imports/plugins/included/default-theme/client/favicons.js
+++ b/imports/plugins/included/default-theme/client/favicons.js
@@ -13,32 +13,32 @@ const linkTags = [
{
rel: "apple-touch-icon",
sizes: "180x180",
- href: basePath + "apple-touch-icon.png"
+ href: `${basePath}apple-touch-icon.png`
},
{
rel: "icon",
type: "image/png",
sizes: "32x32",
- href: basePath + "favicon-32x32.png"
+ href: `${basePath}favicon-32x32.png`
},
{
rel: "icon",
type: "image/png",
sizes: "16x16",
- href: basePath + "favicon-16x16.png"
+ href: `${basePath}favicon-16x16.png`
},
{
rel: "manifest",
- href: basePath + "manifest.json"
+ href: `${basePath}manifest.json`
},
{
rel: "mask-icon",
color: "#5bbad5",
- href: basePath + "safari-pinned-tab.svg"
+ href: `${basePath}safari-pinned-tab.svg`
},
{
rel: "shortcut icon",
- href: basePath + "favicon.ico"
+ href: `${basePath}favicon.ico`
}
];
@@ -47,7 +47,7 @@ const linkTags = [
const metaTags = [
{
name: "msapplication-config",
- content: basePath + "browserconfig.xml"
+ content: `${basePath}browserconfig.xml`
},
{
name: "theme-color",
diff --git a/imports/plugins/included/inventory/server/hooks/inventory-hooks.app-test.js b/imports/plugins/included/inventory/server/hooks/inventory-hooks.app-test.js
index 05e96100294..b5cd12cd956 100644
--- a/imports/plugins/included/inventory/server/hooks/inventory-hooks.app-test.js
+++ b/imports/plugins/included/inventory/server/hooks/inventory-hooks.app-test.js
@@ -47,16 +47,16 @@ describe("Inventory Hooks", function () {
});
function spyOnMethod(method, id) {
- return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function () {
- check(arguments, [Match.Any]); // to prevent audit_arguments from complaining
+ return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function (...args) {
+ check(args, [Match.Any]); // to prevent audit_arguments from complaining
this.userId = id;
- return originals[method].apply(this, arguments);
+ return originals[method].apply(this, args);
});
}
it("should move allocated inventory to 'sold' when an order is created", function () {
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
return true;
});
sandbox.stub(Reaction, "hasPermission", () => true);
@@ -92,8 +92,8 @@ describe("Inventory Hooks", function () {
});
it("should move allocated inventory to 'shipped' when an order is shipped", function (done) {
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
return true;
});
sandbox.stub(Reaction, "hasPermission", () => true);
diff --git a/imports/plugins/included/payments-authnet/client/checkout/authnet.js b/imports/plugins/included/payments-authnet/client/checkout/authnet.js
index c991a5edf0d..098634d5d7a 100644
--- a/imports/plugins/included/payments-authnet/client/checkout/authnet.js
+++ b/imports/plugins/included/payments-authnet/client/checkout/authnet.js
@@ -58,7 +58,7 @@ AutoForm.addHooks("authnet-payment-form", {
};
// Reaction only stores type and 4 digits
- const storedCard = form.type.charAt(0).toUpperCase() + form.type.slice(1) + " " + doc.cardNumber.slice(-4);
+ const storedCard = `${form.type.charAt(0).toUpperCase() + form.type.slice(1)} ${doc.cardNumber.slice(-4)}`;
hidePaymentAlert();
diff --git a/imports/plugins/included/payments-authnet/server/methods/authnet.js b/imports/plugins/included/payments-authnet/server/methods/authnet.js
index 2415f7544b9..1fad5432cdf 100644
--- a/imports/plugins/included/payments-authnet/server/methods/authnet.js
+++ b/imports/plugins/included/payments-authnet/server/methods/authnet.js
@@ -171,8 +171,8 @@ Meteor.methods({
return result;
},
- "authnet/refund/list"() {
- check(arguments, [Match.Any]);
+ "authnet/refund/list"(...args) {
+ check(args, [Match.Any]);
Meteor.Error("not-implemented", "Authorize.net does not yet support retrieving a list of refunds.");
return [];
}
diff --git a/imports/plugins/included/payments-braintree/client/checkout/braintree.js b/imports/plugins/included/payments-braintree/client/checkout/braintree.js
index 96efc9bfa4c..006404a16b4 100644
--- a/imports/plugins/included/payments-braintree/client/checkout/braintree.js
+++ b/imports/plugins/included/payments-braintree/client/checkout/braintree.js
@@ -33,9 +33,9 @@ function hidePaymentAlert() {
}
function handleBraintreeSubmitError(error) {
- const serverError = error !== null ? error.message : void 0;
+ const serverError = error !== null ? error.message : undefined;
if (serverError) {
- return paymentAlert("Server Error " + serverError);
+ return paymentAlert(`Server Error ${serverError}`);
} else if (error) {
return paymentAlert("Oops! Credit card is invalid. Please check your information and try again.");
}
@@ -67,23 +67,24 @@ function submitToBrainTree(doc, template) {
handleBraintreeSubmitError(error);
uiEnd(template, "Resubmit payment");
} else if (results.saved === true) {
- const normalizedStatus = normalizeState(results.response.transaction.status);
- const normalizedMode = normalizeMode(results.response.transaction.status);
+ const tx = results && results.response && results.response.transaction;
+ const normalizedStatus = normalizeState(tx.status);
+ const normalizedMode = normalizeMode(tx.status);
Meteor.subscribe("Packages", Reaction.getShopId());
const packageData = Packages.findOne({
name: "reaction-braintree",
shopId: Reaction.getShopId()
});
- const storedCard = results.response.transaction.creditCard.cardType.toUpperCase() + " " + results.response.transaction.creditCard.last4;
+ const storedCard = `${tx.creditCard.cardType.toUpperCase()} ${tx.creditCard.last4}`;
paymentMethod = {
processor: "Braintree",
storedCard,
paymentPackageId: packageData._id,
paymentSettingsKey: packageData.registry[0].settingsKey,
method: "credit",
- transactionId: results.response.transaction.id,
- amount: parseFloat(results.response.transaction.amount),
+ transactionId: tx.id,
+ amount: parseFloat(tx.amount),
status: normalizedStatus,
mode: normalizedMode,
createdAt: new Date(),
diff --git a/imports/plugins/included/payments-example/client/checkout/example.js b/imports/plugins/included/payments-example/client/checkout/example.js
index f9ab6907718..07f84b84abb 100644
--- a/imports/plugins/included/payments-example/client/checkout/example.js
+++ b/imports/plugins/included/payments-example/client/checkout/example.js
@@ -27,11 +27,11 @@ function hidePaymentAlert() {
}
function handleExampleSubmitError(error) {
- const serverError = error !== null ? error.message : void 0;
+ const serverError = error !== null ? error.message : undefined;
if (serverError) {
- return paymentAlert("Oops! " + serverError);
+ return paymentAlert(`Oops! ${serverError}`);
} else if (error) {
- return paymentAlert("Oops! " + error, null, 4);
+ return paymentAlert(`Oops! ${error}`, null, 4);
}
}
@@ -55,7 +55,7 @@ AutoForm.addHooks("example-payment-form", {
cvv2: doc.cvv,
type: Reaction.getCardType(doc.cardNumber)
};
- const storedCard = form.type.charAt(0).toUpperCase() + form.type.slice(1) + " " + doc.cardNumber.slice(-4);
+ const storedCard = `${form.type.charAt(0).toUpperCase() + form.type.slice(1)} ${doc.cardNumber.slice(-4)}`;
Meteor.subscribe("Packages", Reaction.getShopId());
const packageData = Packages.findOne({
name: "example-paymentmethod",
diff --git a/imports/plugins/included/payments-paypal/client/templates/checkout/express/checkoutButton.js b/imports/plugins/included/payments-paypal/client/templates/checkout/express/checkoutButton.js
index 004999daf01..7c7bdfc2066 100644
--- a/imports/plugins/included/payments-paypal/client/templates/checkout/express/checkoutButton.js
+++ b/imports/plugins/included/payments-paypal/client/templates/checkout/express/checkoutButton.js
@@ -29,7 +29,7 @@ function checkout() {
return Meteor.call("getExpressCheckoutToken", cart._id, (error, token) => {
if (error) {
- const msg = (error !== null ? error.error : void 0) || i18next.t("checkoutPayment.processingError", "There was a problem with your payment.");
+ const msg = (error !== null ? error.error : undefined) || i18next.t("checkoutPayment.processingError", "There was a problem with your payment.");
Alerts.add(msg, "danger", {
placement: "paymentMethod"
});
@@ -105,7 +105,7 @@ Template.paypalCheckoutButton.onRendered(function () {
Template.paypalCheckoutButton.helpers({
expressCheckoutEnabled() {
const expressCheckoutSettings = Session.get("expressCheckoutSettings");
- return expressCheckoutSettings !== undefined ? expressCheckoutSettings.enabled : void 0;
+ return expressCheckoutSettings !== undefined ? expressCheckoutSettings.enabled : undefined;
},
/**
* Check for proper configuration of PayPal Express Checkout settings.
diff --git a/imports/plugins/included/payments-paypal/client/templates/checkout/payflow/payflowForm.js b/imports/plugins/included/payments-paypal/client/templates/checkout/payflow/payflowForm.js
index 1654938dcbf..41170ba0e67 100644
--- a/imports/plugins/included/payments-paypal/client/templates/checkout/payflow/payflowForm.js
+++ b/imports/plugins/included/payments-paypal/client/templates/checkout/payflow/payflowForm.js
@@ -41,11 +41,11 @@ function handlePaypalSubmitError(error) {
const serverError = getError(error, "message");
const errors = getError(error, "response") || [];
if (singleError) {
- return paymentAlert("Oops! " + singleError);
+ return paymentAlert(`Oops! ${singleError}`);
} else if (errors.length) {
for (let i = 0, len = errors.length; i < len; i += 1) {
const thisError = errors[i];
- const formattedError = "Oops! " + thisError.issue + ": " + thisError.field.split(/[. ]+/).pop().replace(/_/g, " ");
+ const formattedError = `Oops! ${thisError.issue}: ${thisError.field.split(/[. ]+/).pop().replace(/_/g, " ")}`;
results.push(paymentAlert(formattedError));
}
return results;
@@ -83,7 +83,7 @@ AutoForm.addHooks("paypal-payment-form", {
cvv2: doc.cvv,
type: Reaction.getCardType(doc.cardNumber)
};
- const storedCard = form.type.charAt(0).toUpperCase() + form.type.slice(1) + " " + doc.cardNumber.slice(-4);
+ const storedCard = `${form.type.charAt(0).toUpperCase() + form.type.slice(1)} ${doc.cardNumber.slice(-4)}`;
PayPal.authorize(form, {
total: Cart.findOne().getTotal(),
currency: Shops.findOne().currency
diff --git a/imports/plugins/included/payments-paypal/client/templates/checkout/return/done.js b/imports/plugins/included/payments-paypal/client/templates/checkout/return/done.js
index 10177cd6072..15e35fe7f60 100644
--- a/imports/plugins/included/payments-paypal/client/templates/checkout/return/done.js
+++ b/imports/plugins/included/payments-paypal/client/templates/checkout/return/done.js
@@ -78,7 +78,7 @@ Template.paypalDone.onCreated(function () {
_id: cart._id
});
}
- const msg = (error !== null ? error.error : void 0);
+ const msg = (error !== null ? error.error : undefined);
showError(msg);
}
diff --git a/imports/plugins/included/payments-paypal/lib/api/express.js b/imports/plugins/included/payments-paypal/lib/api/express.js
index 87f82a3b612..b6d147a89dd 100644
--- a/imports/plugins/included/payments-paypal/lib/api/express.js
+++ b/imports/plugins/included/payments-paypal/lib/api/express.js
@@ -26,7 +26,7 @@ export const Express = {
}).settings;
let mode;
- if ((settings !== null ? settings.express_mode : void 0) === true) {
+ if ((settings !== null ? settings.express_mode : undefined) === true) {
mode = "production";
} else {
mode = "sandbox";
@@ -34,7 +34,7 @@ export const Express = {
const ref = Meteor.settings.paypal;
const options = {
- enabled: settings !== null ? settings.express.enabled : void 0,
+ enabled: settings !== null ? settings.express.enabled : undefined,
mode,
username: getSettings(settings, ref, "username"),
password: getSettings(settings, ref, "password"),
diff --git a/imports/plugins/included/payments-paypal/lib/api/payflow.js b/imports/plugins/included/payments-paypal/lib/api/payflow.js
index fc9eb8d6123..583c1b38ea9 100644
--- a/imports/plugins/included/payments-paypal/lib/api/payflow.js
+++ b/imports/plugins/included/payments-paypal/lib/api/payflow.js
@@ -15,7 +15,7 @@ export const PayFlow = {
enabled: true
}).settings;
let mode;
- if ((settings !== null ? settings.payflow_mode : void 0) === true) {
+ if ((settings !== null ? settings.payflow_mode : undefined) === true) {
mode = "live";
} else {
mode = "sandbox";
diff --git a/imports/plugins/included/payments-paypal/server/methods/express.js b/imports/plugins/included/payments-paypal/server/methods/express.js
index c023d9341f1..a6d0b16423f 100644
--- a/imports/plugins/included/payments-paypal/server/methods/express.js
+++ b/imports/plugins/included/payments-paypal/server/methods/express.js
@@ -29,7 +29,7 @@ export const methods = {
throw new Meteor.Error("invalid-parameter", "Bad shop ID");
}
const amount = Number(cart.getTotal());
- const description = shop.name + " Ref: " + cartId;
+ const description = `${shop.name} Ref: ${cartId}`;
const currency = shop.currency;
const options = PayPal.expressCheckoutAccountOptions();
let response;
@@ -52,7 +52,7 @@ export const methods = {
CURRENCYCODE: currency,
METHOD: "SetExpressCheckout",
INVNUM: cartId,
- CUSTOM: cartId + "|" + amount + "|" + currency
+ CUSTOM: `${cartId}|${amount}|${currency}`
}
});
} catch (error) {
@@ -63,7 +63,7 @@ export const methods = {
}
const parsedResponse = parseResponse(response);
if (parsedResponse.ACK !== "Success") {
- throw new Meteor.Error("ACK " + parsedResponse.ACK + ": " + parsedResponse.L_LONGMESSAGE0);
+ throw new Meteor.Error(`ACK ${parsedResponse.ACK}: ${parsedResponse.L_LONGMESSAGE0}`);
}
return parsedResponse.TOKEN;
},
@@ -120,10 +120,7 @@ export const methods = {
const parsedResponse = parseResponse(response);
if (parsedResponse.ACK !== "Success") {
- throw new Meteor.Error("ACK " +
- parsedResponse.ACK + ": " +
- parsedResponse.L_LONGMESSAGE0 + ":" +
- parsedResponse.L_ERRORCODE0);
+ throw new Meteor.Error(`ACK ${parsedResponse.ACK}: ${parsedResponse.L_LONGMESSAGE0}:${parsedResponse.L_ERRORCODE0}`);
}
return parsedResponse;
},
@@ -202,7 +199,7 @@ export const methods = {
const parsedResponse = parseResponse(response);
if (parsedResponse.ACK !== "Success") {
- throw new Meteor.Error("ACK " + parsedResponse.ACK + ": " + parsedResponse.L_LONGMESSAGE0);
+ throw new Meteor.Error(`ACK ${parsedResponse.ACK}: ${parsedResponse.L_LONGMESSAGE0}`);
}
const result = {
@@ -261,7 +258,7 @@ export const methods = {
const parsedResponse = parseResponse(response);
if (parsedResponse.ACK !== "Success") {
- throw new Meteor.Error("ACK " + parsedResponse.ACK + ": " + parsedResponse.L_LONGMESSAGE0);
+ throw new Meteor.Error(`ACK ${parsedResponse.ACK}: ${parsedResponse.L_LONGMESSAGE0}`);
}
const amountFormatted = {
@@ -323,7 +320,7 @@ export const methods = {
const parsedResponse = parseResponse(response);
if (parsedResponse.ACK !== "Success") {
- throw new Meteor.Error("ACK " + parsedResponse.ACK + ": " + parsedResponse.L_LONGMESSAGE0);
+ throw new Meteor.Error(`ACK ${parsedResponse.ACK}: ${parsedResponse.L_LONGMESSAGE0}`);
}
const result = parseRefundReponse(parsedResponse);
return result;
@@ -353,13 +350,13 @@ function parseRefundReponse(response) {
const paypalArray = [];
for (let i = 0; i < 101; i += 1) {
- const timeStampKey = "L_TIMESTAMP" + i;
+ const timeStampKey = `L_TIMESTAMP${i}`;
const timestamp = response[timeStampKey];
- const typeKey = "L_TYPE" + i;
+ const typeKey = `L_TYPE${i}`;
const transactionType = response[typeKey];
- const amountKey = "L_AMT" + i;
+ const amountKey = `L_AMT${i}`;
const amount = response[amountKey];
- const currencyCodeKey = "L_CURRENCYCODE" + i;
+ const currencyCodeKey = `L_CURRENCYCODE${i}`;
const currencyCode = response[currencyCodeKey];
if (timestamp !== undefined && transactionType === "Refund") {
diff --git a/imports/plugins/included/payments-stripe/server/methods/stripe-payment-create-charges.app-test.js b/imports/plugins/included/payments-stripe/server/methods/stripe-payment-create-charges.app-test.js
index 59e76d56694..870bd94b54d 100644
--- a/imports/plugins/included/payments-stripe/server/methods/stripe-payment-create-charges.app-test.js
+++ b/imports/plugins/included/payments-stripe/server/methods/stripe-payment-create-charges.app-test.js
@@ -204,12 +204,12 @@ describe("stripe/payment/createCharges", function () {
return cart.userId;
});
- sandbox.stub(Meteor.server.method_handlers, "cart/createCart", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "cart/createCart", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
// This stub causes the the charge to go through as the primary shop charge
diff --git a/imports/plugins/included/payments-stripe/server/methods/stripe.js b/imports/plugins/included/payments-stripe/server/methods/stripe.js
index f1aa970f065..cc01bd4fd4e 100644
--- a/imports/plugins/included/payments-stripe/server/methods/stripe.js
+++ b/imports/plugins/included/payments-stripe/server/methods/stripe.js
@@ -158,7 +158,7 @@ function buildPaymentMethods(options) {
}
const shopIds = Object.keys(transactionsByShopId);
- const storedCard = cardData.type.charAt(0).toUpperCase() + cardData.type.slice(1) + " " + cardData.number.slice(-4);
+ const storedCard = `${cardData.type.charAt(0).toUpperCase() + cardData.type.slice(1)} ${cardData.number.slice(-4)}`;
const paymentMethods = [];
@@ -406,7 +406,7 @@ export const methods = {
};
}
// If we get an unexpected error, log and return a censored error message
- Logger.error("Received unexpected error type: " + error.rawType);
+ Logger.error(`Received unexpected error type: ${error.rawType}`);
Logger.error(error);
throw new Meteor.Error("server-error", "An unexpected error occurred while creating multiple stripe charges");
}
diff --git a/imports/plugins/included/product-detail-simple/client/containers/variantList.js b/imports/plugins/included/product-detail-simple/client/containers/variantList.js
index 63240c1479c..0aba066a0a9 100644
--- a/imports/plugins/included/product-detail-simple/client/containers/variantList.js
+++ b/imports/plugins/included/product-detail-simple/client/containers/variantList.js
@@ -115,7 +115,7 @@ class VariantListContainer extends Component {
Reaction.state.set("edit/focus", cardName);
ReactionProduct.setCurrentVariant(variant._id);
- Session.set("variant-form-" + editVariant._id, true);
+ Session.set(`variant-form-${editVariant._id}`, true);
if (Reaction.hasPermission("createProduct") && !Reaction.isPreview()) {
Reaction.showActionView({
diff --git a/imports/plugins/included/product-variant/client/templates/products/productDetail/edit.js b/imports/plugins/included/product-variant/client/templates/products/productDetail/edit.js
index c3d2d20d1d0..d8241cf35c2 100644
--- a/imports/plugins/included/product-variant/client/templates/products/productDetail/edit.js
+++ b/imports/plugins/included/product-variant/client/templates/products/productDetail/edit.js
@@ -79,7 +79,7 @@ Template.productDetailEdit.events({
autosize(Template.instance().$(event.currentTarget));
}
- return Session.set("editing-" + this.field, false);
+ return Session.set(`editing-${this.field}`, false);
}
});
@@ -90,7 +90,7 @@ Template.productDetailEdit.events({
Template.productDetailField.events({
"click .product-detail-field"() {
if (Reaction.hasPermission("createProduct")) {
- const fieldClass = "editing-" + this.field;
+ const fieldClass = `editing-${this.field}`;
Session.set(fieldClass, true);
// Tracker.flush();
return $(`.${this.field}-edit-input`).focus();
diff --git a/imports/plugins/included/product-variant/client/templates/products/productDetail/social.js b/imports/plugins/included/product-variant/client/templates/products/productDetail/social.js
index b11302c2dfd..659735de312 100644
--- a/imports/plugins/included/product-variant/client/templates/products/productDetail/social.js
+++ b/imports/plugins/included/product-variant/client/templates/products/productDetail/social.js
@@ -21,7 +21,7 @@ Template.productSocial.helpers({
media: Session.get("variantImgSrc"),
url: window.location.href,
title: title || "",
- description: typeof product.description === "string" ? product.description.substring(0, 254) : void 0,
+ description: typeof product.description === "string" ? product.description.substring(0, 254) : undefined,
apps: {
facebook: {
description: product.facebookMsg
diff --git a/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variant.js b/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variant.js
index 2573af57b8f..232cfaaa5c8 100644
--- a/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variant.js
+++ b/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variant.js
@@ -88,7 +88,7 @@ function showVariant(variant) {
const selectedProduct = ReactionProduct.selectedProduct();
ReactionProduct.setCurrentVariant(variant._id);
- Session.set("variant-form-" + variant._id, true);
+ Session.set(`variant-form-${variant._id}`, true);
Reaction.Router.go("product", { handle: selectedProduct.handle, variantId: variant._id });
if (Reaction.hasPermission("createProduct")) {
diff --git a/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variantList/variantList.js b/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variantList/variantList.js
index 06061ea5619..2d88e651b18 100644
--- a/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variantList/variantList.js
+++ b/imports/plugins/included/product-variant/client/templates/products/productDetail/variants/variantList/variantList.js
@@ -168,7 +168,7 @@ Template.variantList.helpers({
toggleOn: variantIsInActionView(variant._id),
onClick() {
ReactionProduct.setCurrentVariant(variant._id);
- Session.set("variant-form-" + parentVariant._id, true);
+ Session.set(`variant-form-${parentVariant._id}`, true);
if (Reaction.hasPermission("createProduct")) {
Reaction.showActionView({
diff --git a/imports/plugins/included/product-variant/containers/gridItemControlsContainer.js b/imports/plugins/included/product-variant/containers/gridItemControlsContainer.js
index 267917dbe7b..8f24cc314bd 100644
--- a/imports/plugins/included/product-variant/containers/gridItemControlsContainer.js
+++ b/imports/plugins/included/product-variant/containers/gridItemControlsContainer.js
@@ -34,7 +34,7 @@ const wrapComponent = (Comp) => (
hasCreateProductPermission = () => Reaction.hasPermission("createProduct")
- hasChanges = () => this.props.product.__draft ? true : false
+ hasChanges = () => !!this.props.product.__draft
// This method checks validation of the variants of the all the products on the Products grid to
// check whether all required fields have been submitted before publishing
diff --git a/imports/plugins/included/product-variant/containers/variantFormContainer.js b/imports/plugins/included/product-variant/containers/variantFormContainer.js
index 690384b4417..ab52d710405 100644
--- a/imports/plugins/included/product-variant/containers/variantFormContainer.js
+++ b/imports/plugins/included/product-variant/containers/variantFormContainer.js
@@ -173,7 +173,7 @@ const wrapComponent = (Comp) => (
const variantId = result[0];
ReactionProduct.setCurrentVariant(variantId);
- Session.set("variant-form-" + variantId, true);
+ Session.set(`variant-form-${variantId}`, true);
}
});
}
diff --git a/imports/plugins/included/search-mongo/server/publications/searchresults.js b/imports/plugins/included/search-mongo/server/publications/searchresults.js
index 052b5639fc6..de5e109aa6e 100644
--- a/imports/plugins/included/search-mongo/server/publications/searchresults.js
+++ b/imports/plugins/included/search-mongo/server/publications/searchresults.js
@@ -61,48 +61,70 @@ getResults.orders = function (searchTerm, facets, maxResults, userId) {
const findTerm = {
$and: [
{ shopId },
- { $or: [
- { _id: {
- $regex: `^${regexSafeSearchTerm}`,
- $options: "i"
- } },
- { userEmails: {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { shippingName: {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { billingName: {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { billingCard: {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { billingPhone: {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { shippingPhone: {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { "product.title": {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { "variants.title": {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } },
- { "variants.optionTitle": {
- $regex: regexSafeSearchTerm,
- $options: "i"
- } }
- ] }
+ {
+ $or: [
+ {
+ _id: {
+ $regex: `^${regexSafeSearchTerm}`,
+ $options: "i"
+ }
+ },
+ {
+ userEmails: {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ shippingName: {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ billingName: {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ billingCard: {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ billingPhone: {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ shippingPhone: {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ "product.title": {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ "variants.title": {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ },
+ {
+ "variants.optionTitle": {
+ $regex: regexSafeSearchTerm,
+ $options: "i"
+ }
+ }
+ ]
+ }
]
};
// Deletes the shopId field from "findTerm" for primary shop
@@ -125,24 +147,34 @@ getResults.accounts = function (searchTerm, facets, maxResults, userId) {
const findTerm = {
$and: [
{ shopId },
- { $or: [
- { emails: {
- $regex: searchTerm,
- $options: "i"
- } },
- { "profile.firstName": {
- $regex: "^" + searchTerm + "$",
- $options: "i"
- } },
- { "profile.lastName": {
- $regex: "^" + searchTerm + "$",
- $options: "i"
- } },
- { "profile.phone": {
- $regex: "^" + searchPhone + "$",
- $options: "i"
- } }
- ] }
+ {
+ $or: [
+ {
+ emails: {
+ $regex: searchTerm,
+ $options: "i"
+ }
+ },
+ {
+ "profile.firstName": {
+ $regex: `^${searchTerm}$`,
+ $options: "i"
+ }
+ },
+ {
+ "profile.lastName": {
+ $regex: `^${searchTerm}$`,
+ $options: "i"
+ }
+ },
+ {
+ "profile.phone": {
+ $regex: `^${searchPhone}$`,
+ $options: "i"
+ }
+ }
+ ]
+ }
]
};
// Deletes the shopId field from "findTerm" for primary shop
diff --git a/imports/plugins/included/shipping-rates/server/hooks/hooks.js b/imports/plugins/included/shipping-rates/server/hooks/hooks.js
index 7a9d1a7402f..e2ebe9a6137 100644
--- a/imports/plugins/included/shipping-rates/server/hooks/hooks.js
+++ b/imports/plugins/included/shipping-rates/server/hooks/hooks.js
@@ -107,7 +107,7 @@ function getShippingRates(previousQueryResults, cart) {
}
}
// if we have multiple shops in cart
- if ((shops !== null ? shops.length : void 0) > 0) {
+ if ((shops !== null ? shops.length : undefined) > 0) {
selector = {
"shopId": {
$in: shops
diff --git a/imports/plugins/included/shipping-shippo/client/settings/carriers.js b/imports/plugins/included/shipping-shippo/client/settings/carriers.js
index 828aa707aaf..caab7e392df 100644
--- a/imports/plugins/included/shipping-shippo/client/settings/carriers.js
+++ b/imports/plugins/included/shipping-shippo/client/settings/carriers.js
@@ -49,9 +49,9 @@ Template.shippoCarriers.helpers({
// add i18n handling to headers
const customColumnMetadata = [];
filteredFields.forEach((field) => {
- let colWidth = undefined;
- let colStyle = undefined;
- let colClassName = undefined;
+ let colWidth;
+ let colStyle;
+ let colClassName;
if (field === "enabled") {
colWidth = undefined;
diff --git a/imports/plugins/included/social/client/components/facebook.js b/imports/plugins/included/social/client/components/facebook.js
index fe0d266b04a..e27d09ae756 100644
--- a/imports/plugins/included/social/client/components/facebook.js
+++ b/imports/plugins/included/social/client/components/facebook.js
@@ -46,12 +46,11 @@ class FacebookSocialButton extends Component {
version: this.props.settings.version || "v2.7"
});
(function (d, s, id) {
- let js = void 0;
const fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
- js = d.createElement(s);
+ const js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
diff --git a/imports/plugins/included/social/client/components/googleplus.js b/imports/plugins/included/social/client/components/googleplus.js
index c314f4ffaf7..eb94e9da2ae 100644
--- a/imports/plugins/included/social/client/components/googleplus.js
+++ b/imports/plugins/included/social/client/components/googleplus.js
@@ -43,7 +43,7 @@ class GooglePlusSocialButton extends Component {
const props = this.props;
const preferredUrl = props.url || location.origin + location.pathname;
const url = encodeURIComponent(preferredUrl);
- const href = "https://plus.google.com/share?url=" + url;
+ const href = `https://plus.google.com/share?url=${url}`;
return href;
}
diff --git a/imports/plugins/included/social/client/components/twitter.js b/imports/plugins/included/social/client/components/twitter.js
index 2bb6f95aa3a..4e5e678db5c 100644
--- a/imports/plugins/included/social/client/components/twitter.js
+++ b/imports/plugins/included/social/client/components/twitter.js
@@ -51,10 +51,10 @@ class TwitterSocialButton extends Component {
const text = props.settings.description;
const username = props.settings.username;
- let href = base + "?url=" + url + "&text=" + text;
+ let href = `${base}?url=${url}&text=${text}`;
if (username) {
- href += "&via=" + username;
+ href += `&via=${username}`;
}
return href;
diff --git a/imports/plugins/included/taxes-avalara/client/settings/avalara.js b/imports/plugins/included/taxes-avalara/client/settings/avalara.js
index 29b3f59029c..8b56105c242 100644
--- a/imports/plugins/included/taxes-avalara/client/settings/avalara.js
+++ b/imports/plugins/included/taxes-avalara/client/settings/avalara.js
@@ -82,7 +82,7 @@ Template.avalaraSettings.helpers({
// helper adds a class to every grid row
const customRowMetaData = {
- bodyCssClassName: () => "log-grid-row"
+ bodyCssClassName: () => "log-grid-row"
};
// add i18n handling to headers
diff --git a/imports/plugins/included/taxes-taxcloud/client/containers/taxCloudSettingsFormContainer.js b/imports/plugins/included/taxes-taxcloud/client/containers/taxCloudSettingsFormContainer.js
index 73a5f77b099..1e54395ad85 100644
--- a/imports/plugins/included/taxes-taxcloud/client/containers/taxCloudSettingsFormContainer.js
+++ b/imports/plugins/included/taxes-taxcloud/client/containers/taxCloudSettingsFormContainer.js
@@ -43,8 +43,8 @@ const handlers = {
const composer = (props, onData) => {
const shownFields = {
- ["settings.taxcloud.apiKey"]: TaxCloudPackageConfig._schema["settings.taxcloud.apiKey"],
- ["settings.taxcloud.apiLoginId"]: TaxCloudPackageConfig._schema["settings.taxcloud.apiLoginId"]
+ "settings.taxcloud.apiKey": TaxCloudPackageConfig._schema["settings.taxcloud.apiKey"],
+ "settings.taxcloud.apiLoginId": TaxCloudPackageConfig._schema["settings.taxcloud.apiLoginId"]
};
const hiddenFields = [
"settings.taxcloud.enabled",
diff --git a/lib/api/files.js b/lib/api/files.js
index 498ee1610cc..b9b645e4572 100644
--- a/lib/api/files.js
+++ b/lib/api/files.js
@@ -14,7 +14,7 @@ function _copyStoreData(fileObj, storeName, sourceKey, callback) {
const storage = fileObj.collection.storesLookup[storeName];
if (!storage) {
- throw new Error(storeName + " is not a valid store name");
+ throw new Error(`${storeName} is not a valid store name`);
}
// We want to prevent beforeWrite and transformWrite from running, so
@@ -85,13 +85,13 @@ export function copyFile(fileObj, newMetaData) {
// createReadStreamForFileKey
const sourceFileStorage = self.collection.storesLookup[name];
if (!sourceFileStorage) {
- throw new Error(name + " is not a valid store name");
+ throw new Error(`${name} is not a valid store name`);
}
oldKey = sourceFileStorage.adapter.fileKey(self);
// delete so that new fileKey will be generated in copyStoreData
delete newFile.copies[name].key;
mod = mod || {};
- mod["copies." + name + ".key"] = copyStoreData(newFile, name, oldKey);
+ mod[`copies.${name}.key`] = copyStoreData(newFile, name, oldKey);
}
}
}
diff --git a/lib/api/helpers.js b/lib/api/helpers.js
index 7591cb2ee78..f05ba4905cc 100644
--- a/lib/api/helpers.js
+++ b/lib/api/helpers.js
@@ -106,7 +106,7 @@ export function getShopPrefix(leading = "/") {
// If this is not the primary shop, use the shop slug in routes for this shop
// TODO: "/shop" should be configurable in marketplace settings
- return "/shop" + slug;
+ return `/shop${slug}`;
}
return "";
diff --git a/lib/api/match.js b/lib/api/match.js
index d7b64a48152..b3d3a84de40 100644
--- a/lib/api/match.js
+++ b/lib/api/match.js
@@ -17,7 +17,7 @@ import { Match } from "meteor/check";
* @return {Boolean} matches - void, null, or pattern
*/
Match.OptionalOrNull = function (pattern) {
- return Match.OneOf(void 0, null, pattern);
+ return Match.OneOf(undefined, null, pattern);
};
/**
diff --git a/lib/api/products.js b/lib/api/products.js
index f6f33c98ea9..a966d67e092 100644
--- a/lib/api/products.js
+++ b/lib/api/products.js
@@ -575,7 +575,7 @@ ReactionProduct.archiveProduct = function (productOrArray) {
products[0].title || i18next.t("productDetail.archiveErrorTheProduct") :
i18next.t("productDetail.theSelectedProducts");
Alerts.toast(i18next.t("productDetail.productArchiveError", { product: title }), "error");
- throw new Meteor.Error("error-occurred" + title, error);
+ throw new Meteor.Error(`error-occurred${title}`, error);
}
if (result) {
Router.go("/");
diff --git a/lib/collections/collectionFS.js b/lib/collections/collectionFS.js
index a63331e37d5..1af2e3375e0 100644
--- a/lib/collections/collectionFS.js
+++ b/lib/collections/collectionFS.js
@@ -62,7 +62,7 @@ export const Media = new FS.Collection("Media", {
transformWrite(fileObj, readStream, writeStream) {
if (gm.isAvailable) {
gm(readStream)
- .resize("235", "235" + "^")
+ .resize("235", "235^")
.gravity("Center")
.extent("235", "235")
.stream("PNG")
@@ -76,7 +76,7 @@ export const Media = new FS.Collection("Media", {
transformWrite(fileObj, readStream, writeStream) {
if (gm.isAvailable) {
gm(readStream)
- .resize("100", "100" + "^")
+ .resize("100", "100^")
.gravity("Center")
.extent("100", "100")
.stream("PNG")
diff --git a/server/api/core/accounts/password.js b/server/api/core/accounts/password.js
index 6def6b6102e..1bfc1097d92 100644
--- a/server/api/core/accounts/password.js
+++ b/server/api/core/accounts/password.js
@@ -64,7 +64,7 @@ export function sendResetPasswordEmail(userId, optionalEmail) {
const mediaId = Media.findOne(brandAsset.mediaId);
emailLogo = path.join(Meteor.absoluteUrl(), mediaId.url());
} else {
- emailLogo = Meteor.absoluteUrl() + "resources/email-templates/shop-logo.png";
+ emailLogo = `${Meteor.absoluteUrl()}resources/email-templates/shop-logo.png`;
}
const dataForEmail = {
@@ -86,17 +86,17 @@ export function sendResetPasswordEmail(userId, optionalEmail) {
display: true,
facebook: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/facebook-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/facebook-icon.png`,
link: "https://www.facebook.com"
},
googlePlus: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/google-plus-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/google-plus-icon.png`,
link: "https://plus.google.com"
},
twitter: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/twitter-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/twitter-icon.png`,
link: "https://www.twitter.com"
}
},
@@ -178,7 +178,7 @@ export function sendVerificationEmail(userId, email) {
// Reaction Information
contactEmail: "hello@reactioncommerce.com",
homepage: Meteor.absoluteUrl(),
- emailLogo: Meteor.absoluteUrl() + "resources/placeholder.gif",
+ emailLogo: `${Meteor.absoluteUrl()}resources/placeholder.gif`,
copyrightDate: moment().format("YYYY"),
legalName: "Reaction Commerce",
physicalAddress: {
@@ -295,7 +295,7 @@ export function sendUpdatedVerificationEmail(userId, email) {
// Reaction Information
contactEmail: "hello@reactioncommerce.com",
homepage: Meteor.absoluteUrl(),
- emailLogo: Meteor.absoluteUrl() + "resources/placeholder.gif",
+ emailLogo: `${Meteor.absoluteUrl()}resources/placeholder.gif`,
copyrightDate: moment().format("YYYY"),
legalName: "Reaction Commerce",
physicalAddress: {
diff --git a/server/api/core/core.js b/server/api/core/core.js
index 139c05ff561..99dcca31ab8 100644
--- a/server/api/core/core.js
+++ b/server/api/core/core.js
@@ -293,7 +293,7 @@ export default {
* @return {String} Prefix in the format of "/"
*/
getPrimaryShopPrefix() {
- return "/" + this.getSlug(this.getPrimaryShopName().toLowerCase());
+ return `/${this.getSlug(this.getPrimaryShopName().toLowerCase())}`;
},
/**
@@ -519,7 +519,8 @@ export default {
}, {
fields: {
language: 1
- } });
+ }
+ });
return language;
},
diff --git a/server/api/core/endpoints.js b/server/api/core/endpoints.js
index 3a40e74fd93..07dcf8052ed 100644
--- a/server/api/core/endpoints.js
+++ b/server/api/core/endpoints.js
@@ -65,8 +65,8 @@ function writeJsonToBody(res, json) {
// That's why we cache them and then add after startup.
let errorMiddlewares = [];
Endpoints.ErrorMiddleware = {
- use() {
- errorMiddlewares.push(arguments);
+ use(...args) {
+ errorMiddlewares.push(args);
}
};
@@ -82,7 +82,7 @@ Meteor.startup(() => {
}
return maybeFn;
});
- WebApp.connectHandlers.use.apply(WebApp.connectHandlers, errorMiddlewareFn);
+ WebApp.connectHandlers.use.apply(WebApp.connectHandlers, ...errorMiddlewareFn);
});
errorMiddlewares = [];
@@ -106,7 +106,7 @@ Endpoints.add = function (method, path, handler) {
// Make sure path starts with a slash
let slashedPath = path;
if (path[0] !== "/") {
- slashedPath = "/" + path;
+ slashedPath = `/${path}`;
}
// Add to list of known Endpoints
diff --git a/server/api/core/import.js b/server/api/core/import.js
index 582e807aa85..7bb2fa907c0 100644
--- a/server/api/core/import.js
+++ b/server/api/core/import.js
@@ -127,24 +127,25 @@ Import.commit = function (collection) {
const nRemoved = result.nRemoved;
// Log some information about the import.
if (nTouched) {
- let message = "Modified " + nImported + (nImported === 1 ? " document" : " documents");
- message += " while importing " + nTouched + " to " + name;
+ let message = `Modified ${nImported}${nImported === 1 ? " document" : " documents"}`;
+ message += ` while importing ${nTouched} to ${name}`;
Logger.debug(message);
}
if (nRemoved) {
- let message = "Removed " + nRemoved + (nRemoved === 1 ? " document" : " documents");
- message += " from " + name;
+ let message = `Removed ${nRemoved}${nRemoved === 1 ? " document" : " documents"}`;
+ message += ` from ${name}`;
Logger.debug(message);
}
// Log any errors returned.
- const message = "Error while importing to " + name;
+ const message = `Error while importing to ${name}`;
const writeErrors = result.getWriteErrors();
+
for (let i = 0; i < writeErrors.length; i += 1) {
- Logger.warn(message + ": " + writeErrors[i].errmsg);
+ Logger.warn(`${message}: ${writeErrors[i].errmsg}`);
}
const writeConcernError = result.getWriteConcernError();
if (writeConcernError) {
- Logger.warn(message + ": " + writeConcernError.errmsg);
+ Logger.warn(`${message}: ${writeConcernError.errmsg}`);
}
});
// Reset the buffer.
diff --git a/server/api/core/loadSettings.js b/server/api/core/loadSettings.js
index 75f18508dc3..cccb35dda3a 100644
--- a/server/api/core/loadSettings.js
+++ b/server/api/core/loadSettings.js
@@ -74,8 +74,7 @@ export function loadSettings(json) {
}, {
$set: settings
});
- Logger.debug("service configuration loaded: " +
- item.name + " | " + service);
+ Logger.debug(`service configuration loaded: ${item.name} | ${service}`);
}
}
}
diff --git a/server/api/core/rightJoin.js b/server/api/core/rightJoin.js
index 972c3ef8ef5..6d0bcdc3724 100644
--- a/server/api/core/rightJoin.js
+++ b/server/api/core/rightJoin.js
@@ -37,8 +37,7 @@ const doRightJoinNoIntersection = (leftSet, rightSet) => {
if ({}.hasOwnProperty.call(leftSet, key) && (typeof (leftSet[key]) !== "object" ||
Array.isArray(leftSet[key]) !== Array.isArray(rightSet[key]))) {
// This is not expected!
- throw new Error("Left object and right object's internal structure must be " +
- "congruent! Offending key: " + key);
+ throw new Error(`${"Left object and right object's internal structure must be congruent! Offending key: "}${key}`);
}
const rightSubJoin = doRightJoinNoIntersection(
{}.hasOwnProperty.call(leftSet, key) ? leftSet[key] : {},
diff --git a/server/api/core/setDomain.js b/server/api/core/setDomain.js
index e238ce3b4b0..2ae27e018a4 100644
--- a/server/api/core/setDomain.js
+++ b/server/api/core/setDomain.js
@@ -10,7 +10,7 @@ import { Logger } from "/server/api";
*/
export function getRegistryDomain(requestUrl) {
const url = requestUrl || process.env.ROOT_URL;
- const domain = url.match(/^https?\:\/\/([^\/:?#]+)(?:[\/:?#]|$)/i)[1];
+ const domain = url.match(/^https?:\/\/([^/:?#]+)(?:[/:?#]|$)/i)[1];
return domain;
}
@@ -32,7 +32,7 @@ export function setDomain() {
// if the server domain changes, update shop
const domain = getRegistryDomain();
if (currentDomain && currentDomain !== domain) {
- Logger.debug("Updating domain to " + domain);
+ Logger.debug(`Updating domain to ${domain}`);
Shops.update({
domains: currentDomain
}, {
diff --git a/server/api/method-hooks.js b/server/api/method-hooks.js
index bee9f51cbbc..75c6eeea520 100644
--- a/server/api/method-hooks.js
+++ b/server/api/method-hooks.js
@@ -86,9 +86,9 @@ MethodHooks._initializeHook = function (mapping, methodName, hookFunction) {
// Get a reference to the original handler
MethodHooks._originalMethodHandlers[methodName] = method;
- MethodHooks._wrappers[methodName] = function () {
+ MethodHooks._wrappers[methodName] = function (...inputArgs) {
// Get arguments you can mutate
- const args = _.toArray(arguments);
+ const args = _.toArray(inputArgs);
let beforeResult;
// Call the before hooks
diff --git a/server/imports/fixtures/cart.js b/server/imports/fixtures/cart.js
index b0d2d1bd035..65ff25538b5 100755
--- a/server/imports/fixtures/cart.js
+++ b/server/imports/fixtures/cart.js
@@ -21,9 +21,11 @@ import { addProduct } from "./products";
export function getCartItem(options = {}) {
const product = addProduct();
const variant = Products.findOne({ ancestors: [product._id] });
- const childVariants = Products.find({ ancestors: [
- product._id, variant._id
- ] }).fetch();
+ const childVariants = Products.find({
+ ancestors: [
+ product._id, variant._id
+ ]
+ }).fetch();
const selectedOption = Random.choice(childVariants);
const defaults = {
_id: Random.id(),
diff --git a/server/imports/fixtures/fixtures.app-test.js b/server/imports/fixtures/fixtures.app-test.js
index ec7bc495b79..83e52469b26 100644
--- a/server/imports/fixtures/fixtures.app-test.js
+++ b/server/imports/fixtures/fixtures.app-test.js
@@ -72,11 +72,11 @@ describe("Fixtures:", function () {
sandbox.stub(Collections.Orders._hookAspects.insert.before[0], "aspect");
sandbox.stub(Collections.Orders._hookAspects.update.before[0], "aspect");
sandbox.stub(Reaction, "hasPermission", () => true);
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function (...args) {
+ check(args, [Match.Any]);
});
const order = Factory.create("order");
expect(order).to.not.be.undefined;
diff --git a/server/imports/fixtures/orders.js b/server/imports/fixtures/orders.js
index f8eea0737cb..e08f6bb7d60 100755
--- a/server/imports/fixtures/orders.js
+++ b/server/imports/fixtures/orders.js
@@ -94,15 +94,19 @@ export default function () {
items() {
const product = addProduct({ shopId });
const variant = Products.findOne({ ancestors: [product._id] });
- const childVariants = Products.find({ ancestors: [
- product._id, variant._id
- ] }).fetch();
+ const childVariants = Products.find({
+ ancestors: [
+ product._id, variant._id
+ ]
+ }).fetch();
const selectedOption = Random.choice(childVariants);
const product2 = addProduct({ shopId });
const variant2 = Products.findOne({ ancestors: [product2._id] });
- const childVariants2 = Products.find({ ancestors: [
- product2._id, variant2._id
- ] }).fetch();
+ const childVariants2 = Products.find({
+ ancestors: [
+ product2._id, variant2._id
+ ]
+ }).fetch();
const selectedOption2 = Random.choice(childVariants2);
return [{
_id: itemIdOne,
diff --git a/server/imports/fixtures/products.js b/server/imports/fixtures/products.js
index 1fb4710bfb9..e38fd549669 100755
--- a/server/imports/fixtures/products.js
+++ b/server/imports/fixtures/products.js
@@ -100,7 +100,7 @@ export function getProduct() {
export function getProducts(limit = 2) {
const products = [];
const existingProducts = Products.find({}, { limit }).fetch();
- for (let i = 0; i < limit; i = i + 1) {
+ for (let i = 0; i < limit; i += 1) {
const product = existingProducts[i] || Factory.create("product");
products.push(product);
}
diff --git a/server/imports/fixtures/users.js b/server/imports/fixtures/users.js
index c3664171c13..2cac8ebf752 100755
--- a/server/imports/fixtures/users.js
+++ b/server/imports/fixtures/users.js
@@ -14,7 +14,7 @@ export function getUser() {
export function getUsers(limit = 2) {
const users = [];
const existingUsers = Meteor.users.find({}, { limit }).fetch();
- for (let i = 0; i < limit; i = i + 1) {
+ for (let i = 0; i < limit; i += 1) {
const user = existingUsers[i] || Factory.create("user");
users.push(user);
}
diff --git a/server/methods/accounts/accounts.app-test.js b/server/methods/accounts/accounts.app-test.js
index 5ccb191690d..a8ec0d53ae6 100644
--- a/server/methods/accounts/accounts.app-test.js
+++ b/server/methods/accounts/accounts.app-test.js
@@ -54,10 +54,10 @@ describe("Account Meteor method ", function () {
});
function spyOnMethod(method, id) {
- return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function () {
- check(arguments, [Match.Any]); // to prevent audit_arguments from complaining
+ return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function (...args) {
+ check(args, [Match.Any]); // to prevent audit_arguments from complaining
this.userId = id;
- return originals[method].apply(this, arguments);
+ return originals[method].apply(this, args);
});
}
@@ -211,8 +211,8 @@ describe("Account Meteor method ", function () {
let removeInventoryStub;
before(function () {
- removeInventoryStub = sinon.stub(Meteor.server.method_handlers, "inventory/remove", function () {
- check(arguments, [Match.Any]);
+ removeInventoryStub = sinon.stub(Meteor.server.method_handlers, "inventory/remove", function (...args) {
+ check(args, [Match.Any]);
return true;
});
});
diff --git a/server/methods/accounts/accounts.js b/server/methods/accounts/accounts.js
index ee9d1527739..d10fdcb3882 100644
--- a/server/methods/accounts/accounts.js
+++ b/server/methods/accounts/accounts.js
@@ -763,7 +763,7 @@ export function sendWelcomeEmail(shopId, userId) {
const mediaId = Media.findOne(brandAsset.mediaId);
emailLogo = path.join(Meteor.absoluteUrl(), mediaId.url());
} else {
- emailLogo = Meteor.absoluteUrl() + "resources/email-templates/shop-logo.png";
+ emailLogo = `${Meteor.absoluteUrl()}resources/email-templates/shop-logo.png`;
}
const dataForEmail = {
@@ -784,17 +784,17 @@ export function sendWelcomeEmail(shopId, userId) {
display: true,
facebook: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/facebook-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/facebook-icon.png`,
link: "https://www.facebook.com"
},
googlePlus: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/google-plus-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/google-plus-icon.png`,
link: "https://plus.google.com"
},
twitter: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/twitter-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/twitter-icon.png`,
link: "https://www.twitter.com"
}
},
@@ -930,7 +930,7 @@ function getEmailLogo(shop) {
const mediaId = Media.findOne(brandAsset.mediaId);
emailLogo = path.join(Meteor.absoluteUrl(), mediaId.url());
} else {
- emailLogo = Meteor.absoluteUrl() + "resources/email-templates/shop-logo.png";
+ emailLogo = `${Meteor.absoluteUrl()}resources/email-templates/shop-logo.png`;
}
return emailLogo;
}
@@ -991,17 +991,17 @@ function getDataForEmail(options) {
display: true,
facebook: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/facebook-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/facebook-icon.png`,
link: "https://www.facebook.com"
},
googlePlus: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/google-plus-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/google-plus-icon.png`,
link: "https://plus.google.com"
},
twitter: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/twitter-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/twitter-icon.png`,
link: "https://www.twitter.com"
}
},
diff --git a/server/methods/catalog.app-test.js b/server/methods/catalog.app-test.js
index 0a0606977a8..52e4452b6cb 100644
--- a/server/methods/catalog.app-test.js
+++ b/server/methods/catalog.app-test.js
@@ -87,9 +87,11 @@ describe("core product methods", function () {
sandbox.stub(Reaction, "hasPermission", () => true);
const product = addProduct();
const variant = Products.find({ ancestors: [product._id] }).fetch();
- let optionCount = Products.find({ ancestors: {
- $in: [variant[0]._id]
- } }).count();
+ let optionCount = Products.find({
+ ancestors: {
+ $in: [variant[0]._id]
+ }
+ }).count();
expect(optionCount).to.equal(2);
Meteor.call("products/cloneVariant", product._id, variant[0]._id);
@@ -281,9 +283,11 @@ describe("core product methods", function () {
sandbox.stub(Reaction, "hasPermission", () => true);
const product = addProduct();
const variant = Products.find({ ancestors: [product._id] }).fetch()[0];
- const variants = Products.find({ ancestors: {
- $in: [variant._id]
- } }).fetch();
+ const variants = Products.find({
+ ancestors: {
+ $in: [variant._id]
+ }
+ }).fetch();
expect(variants.length).to.equal(2);
Meteor.call("products/deleteVariant", variant._id);
});
@@ -299,8 +303,8 @@ describe("core product methods", function () {
it("should throw 403 error by non admin", function () {
sandbox.stub(Reaction, "hasPermission", () => false);
- sandbox.stub(Meteor.server.method_handlers, "inventory/remove", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/remove", function (...args) {
+ check(args, [Match.Any]);
});
const insertProductSpy = sandbox.spy(Products, "insert");
expect(() => Meteor.call("products/cloneProduct", {})).to.throw(Meteor.Error, /Access Denied/);
@@ -309,8 +313,8 @@ describe("core product methods", function () {
it("should clone product", function (done) {
sandbox.stub(Reaction, "hasPermission", () => true);
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
const product = addProduct();
expect(Products.find({ type: "simple" }).count()).to.equal(1);
@@ -322,8 +326,8 @@ describe("core product methods", function () {
},
type: "simple"
}).fetch()[0];
- expect(productCloned.title).to.equal(product.title + "-copy");
- expect(productCloned.handle).to.equal(product.handle + "-copy");
+ expect(productCloned.title).to.equal(`${product.title}-copy`);
+ expect(productCloned.handle).to.equal(`${product.handle}-copy`);
expect(productCloned.pageTitle).to.equal(product.pageTitle);
expect(productCloned.description).to.equal(product.description);
@@ -332,8 +336,8 @@ describe("core product methods", function () {
it("product should be cloned with all variants and child variants with equal data, but not the same `_id`s", function (done) {
sandbox.stub(Reaction, "hasPermission", () => true);
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
const product = addProduct();
const variants = Products.find({ ancestors: { $in: [product._id] } }).fetch();
@@ -357,8 +361,8 @@ describe("core product methods", function () {
it("product group cloning should create the same number of new products", function (done) {
sandbox.stub(Reaction, "hasPermission", () => true);
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
const product = addProduct();
const product2 = addProduct();
@@ -376,8 +380,8 @@ describe("core product methods", function () {
it("product group cloning should create the same number of cloned variants", function (done) {
sandbox.stub(Reaction, "hasPermission", () => true);
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
const product = addProduct();
const product2 = addProduct();
diff --git a/server/methods/catalog.js b/server/methods/catalog.js
index bea49d57d0d..cf8884073e9 100644
--- a/server/methods/catalog.js
+++ b/server/methods/catalog.js
@@ -89,7 +89,7 @@ function createTitle(newTitle, productId) {
title = `${titleString}-${titleNumberSuffix + titleCount}`;
} else {
// first copy will be "...-copy", second: "...-copy-2"
- title = `${titleString}-copy${titleCount > 1 ? "-" + titleCount : ""}`;
+ title = `${titleString}-copy${titleCount > 1 ? `-${titleCount}` : ""}`;
}
}
@@ -146,8 +146,7 @@ function createHandle(productHandle, productId) {
handle = `${handleString}-${handleNumberSuffix + handleCount}`;
} else {
// first copy will be "...-copy", second: "...-copy-2"
- handle = `${handleString}-copy${handleCount > 1
- ? '-' + handleCount : ''}`;
+ handle = `${handleString}-copy${handleCount > 1 ? `-${handleCount}` : ''}`;
}
}
@@ -479,7 +478,7 @@ Meteor.methods({
if (!newVariant) {
Object.assign(assembledVariant, {
- title: product.title + " - Untitled option",
+ title: `${product.title} - Untitled option`,
price: 0.00
});
}
@@ -894,7 +893,7 @@ Meteor.methods({
// handle booleans with correct typing
if (value === "false" || value === "true") {
const booleanValue = (value === "true" || value === true);
- update = EJSON.parse("{\"" + field + "\":" + booleanValue + "}");
+ update = EJSON.parse(`{"${field}":${booleanValue}}`);
} else if (field === "handle") {
update = {
[field]: createHandle(value, _id) // handle should be unique
@@ -907,7 +906,7 @@ Meteor.methods({
};
} else {
const stringValue = EJSON.stringify(value);
- update = EJSON.parse("{\"" + field + "\":" + stringValue + "}");
+ update = EJSON.parse(`{"${field}":${stringValue}}`);
}
diff --git a/server/methods/core/cart-create.app-test.js b/server/methods/core/cart-create.app-test.js
index e2ac5be24cd..b28858ebb32 100644
--- a/server/methods/core/cart-create.app-test.js
+++ b/server/methods/core/cart-create.app-test.js
@@ -54,10 +54,10 @@ describe("Add/Create cart methods", function () {
function spyOnMethod(method, id) {
- return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function () {
- check(arguments, [Match.Any]); // to prevent audit_arguments from complaining
+ return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function (...args) {
+ check(args, [Match.Any]); // to prevent audit_arguments from complaining
this.userId = id;
- return originals[method].apply(this, arguments);
+ return originals[method].apply(this, args);
});
}
@@ -86,12 +86,12 @@ describe("Add/Create cart methods", function () {
return true;
});
- resetShipmentStub = sinon.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function () {
- check(arguments, [Match.Any]);
+ resetShipmentStub = sinon.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function (...args) {
+ check(args, [Match.Any]);
return true;
});
- updateShipmentQuoteStub = sinon.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function () {
- check(arguments, [Match.Any]);
+ updateShipmentQuoteStub = sinon.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function (...args) {
+ check(args, [Match.Any]);
return true;
});
diff --git a/server/methods/core/cart-merge.app-test.js b/server/methods/core/cart-merge.app-test.js
index 5aede293701..0e8c772d15f 100644
--- a/server/methods/core/cart-merge.app-test.js
+++ b/server/methods/core/cart-merge.app-test.js
@@ -41,8 +41,8 @@ describe("Merge Cart function ", function () {
Collections.Products.remove({});
// mock it. If you want to make full integration test, comment this out
- pushCartWorkflowStub = sinon.stub(Meteor.server.method_handlers, "workflow/pushCartWorkflow", function () {
- check(arguments, [Match.Any]);
+ pushCartWorkflowStub = sinon.stub(Meteor.server.method_handlers, "workflow/pushCartWorkflow", function (...args) {
+ check(args, [Match.Any]);
return true;
});
});
@@ -64,10 +64,10 @@ describe("Merge Cart function ", function () {
});
function spyOnMethod(method, id) {
- return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function () {
- check(arguments, [Match.Any]); // to prevent audit_arguments from complaining
+ return sandbox.stub(Meteor.server.method_handlers, `cart/${method}`, function (...args) {
+ check(args, [Match.Any]); // to prevent audit_arguments from complaining
this.userId = id;
- return originals[method].apply(this, arguments);
+ return originals[method].apply(this, args);
});
}
diff --git a/server/methods/core/cart-remove.app-test.js b/server/methods/core/cart-remove.app-test.js
index 314c34e9b9f..41f078ddf7f 100644
--- a/server/methods/core/cart-remove.app-test.js
+++ b/server/methods/core/cart-remove.app-test.js
@@ -41,11 +41,11 @@ describe("cart methods", function () {
const cartUserId = cart.userId;
sandbox.stub(Reaction, "getShopId", () => shop._id);
sandbox.stub(Meteor, "userId", () => cartUserId);
- sandbox.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function (...args) {
+ check(args, [Match.Any]);
});
const updateSpy = sandbox.spy(Collections.Cart, "update");
const cartFromCollection = Collections.Cart.findOne(cart._id);
@@ -60,11 +60,11 @@ describe("cart methods", function () {
});
it("should decrease the quantity when called with a quantity", function () {
- sandbox.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function (...args) {
+ check(args, [Match.Any]);
});
const cart = Factory.create("cartTwo");
const cartUserId = cart.userId;
@@ -79,11 +79,11 @@ describe("cart methods", function () {
});
it("should remove cart item when quantity is decresed to zero", function () {
- sandbox.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "cart/resetShipmentMethod", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "shipping/updateShipmentQuotes", function (...args) {
+ check(args, [Match.Any]);
});
const cart = Factory.create("cartOne");
const cartUserId = cart.userId;
diff --git a/server/methods/core/cart.js b/server/methods/core/cart.js
index 8221af596d0..70731b5df62 100644
--- a/server/methods/core/cart.js
+++ b/server/methods/core/cart.js
@@ -275,13 +275,11 @@ Meteor.methods({
sessionId,
userId
});
- Logger.debug("create cart: into new user cart. created: " + currentCartId +
- " for user " + userId);
+ Logger.debug(`create cart: into new user cart. created: ${currentCartId} for user ${userId}`);
// merge session carts into the current cart
if (sessionCartCount > 0 && !anonymousUser) {
- Logger.debug("create cart: found existing cart. merge into " + currentCartId
- + " for user " + userId);
+ Logger.debug(`create cart: found existing cart. merge into ${currentCartId} for user ${userId}`);
Meteor.call("cart/mergeCart", currentCartId, sessionId);
}
@@ -353,10 +351,14 @@ Meteor.methods({
// `quantityProcessing`?
let product;
let variant;
- Collections.Products.find({ _id: { $in: [
- productId,
- variantId
- ] } }).forEach((doc) => {
+ Collections.Products.find({
+ _id: {
+ $in: [
+ productId,
+ variantId
+ ]
+ }
+ }).forEach((doc) => {
if (doc.type === "simple") {
product = doc;
} else {
diff --git a/server/methods/core/cartToOrder.js b/server/methods/core/cartToOrder.js
index 3cac15ad02d..b3ecff3f315 100644
--- a/server/methods/core/cartToOrder.js
+++ b/server/methods/core/cartToOrder.js
@@ -200,7 +200,7 @@ export function copyCartToOrder(cartId) {
}
}
- Logger.info("Transitioned cart " + cartId + " to order " + orderId);
+ Logger.info(`Transitioned cart ${cartId} to order ${orderId}`);
// catch send notification, we don't want
// to block because of notification errors
diff --git a/server/methods/core/groups.app-test.js b/server/methods/core/groups.app-test.js
index 4eaee873cfe..8eda92197b6 100644
--- a/server/methods/core/groups.app-test.js
+++ b/server/methods/core/groups.app-test.js
@@ -52,10 +52,10 @@ describe("Group test", function () {
});
function spyOnMethod(method, id) {
- return sandbox.stub(Meteor.server.method_handlers, `group/${method}`, function () {
- check(arguments, [Match.Any]); // to prevent audit_arguments from complaining
+ return sandbox.stub(Meteor.server.method_handlers, `group/${method}`, function (...args) {
+ check(args, [Match.Any]); // to prevent audit_arguments from complaining
this.userId = id;
- return methods[method].apply(this, arguments);
+ return methods[method].apply(this, args);
});
}
diff --git a/server/methods/core/orders.app-test.js b/server/methods/core/orders.app-test.js
index 1121158475c..50c28b969ed 100644
--- a/server/methods/core/orders.app-test.js
+++ b/server/methods/core/orders.app-test.js
@@ -51,11 +51,11 @@ describe("orders test", function () {
// });
sandbox.stub(Orders._hookAspects.insert.before[0], "aspect");
sandbox.stub(Orders._hookAspects.update.before[0], "aspect");
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function (...args) {
+ check(args, [Match.Any]);
});
order = Factory.create("order");
@@ -72,10 +72,10 @@ describe("orders test", function () {
});
function spyOnMethod(method, id) {
- return sandbox.stub(Meteor.server.method_handlers, `orders/${method}`, function () {
- check(arguments, [Match.Any]); // to prevent audit_arguments from complaining
+ return sandbox.stub(Meteor.server.method_handlers, `orders/${method}`, function (...args) {
+ check(args, [Match.Any]); // to prevent audit_arguments from complaining
this.userId = id;
- return methods[method].apply(this, arguments);
+ return methods[method].apply(this, args);
});
}
@@ -90,15 +90,15 @@ describe("orders test", function () {
}
function orderCreditMethod(orderData) {
- const billingRecord = orderData.billing.filter((value) => value.paymentMethod.method === "credit");
+ const billingRecord = orderData.billing.filter((value) => value.paymentMethod.method === "credit");
const billingObject = billingRecord.find((billing) => billing.shopId === shopId);
return billingObject;
}
describe("orders/cancelOrder", function () {
beforeEach(function () {
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
});
@@ -318,8 +318,8 @@ describe("orders test", function () {
it("should update the order item workflow status to coreOrderItemWorkflow/completed", function () {
sandbox.stub(Reaction, "hasPermission", () => true);
const shipment = shippingObjectMethod(order);
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
spyOnMethod("shipmentShipped", order.userId);
Meteor.call("orders/shipmentShipped", order, shipment);
@@ -330,8 +330,8 @@ describe("orders test", function () {
it("should update the order workflow status to completed", function () {
sandbox.stub(Reaction, "hasPermission", () => true);
const shipment = shippingObjectMethod(order);
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
spyOnMethod("shipmentShipped", order.userId);
Meteor.call("orders/shipmentShipped", order, shipment);
@@ -342,8 +342,8 @@ describe("orders test", function () {
it("should update the order shipping workflow status to coreOrderWorkflow/shipped", function () {
sandbox.stub(Reaction, "hasPermission", () => true);
const shipment = shippingObjectMethod(order);
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
spyOnMethod("shipmentShipped", order.userId);
Meteor.call("orders/shipmentShipped", order, shipment);
@@ -354,8 +354,8 @@ describe("orders test", function () {
describe("orders/shipmentDelivered", function () {
beforeEach(function () {
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
});
@@ -528,8 +528,8 @@ describe("orders test", function () {
it("should update order payment method status to error if payment processor fails", function (done) {
sandbox.stub(Reaction, "hasPermission", () => true);
spyOnMethod("capturePayments", order.userId);
- sandbox.stub(Meteor.server.method_handlers, "example/payment/capture", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "example/payment/capture", function (...args) {
+ check(args, [Match.Any]);
return {
error: "stub error",
saved: false
@@ -557,8 +557,8 @@ describe("orders test", function () {
describe("orders/refunds/create", function () {
beforeEach(function () {
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
});
@@ -586,8 +586,8 @@ describe("orders test", function () {
describe("orders/refunds/refundItems", function () {
beforeEach(function () {
- sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "orders/sendNotification", function (...args) {
+ check(args, [Match.Any]);
});
});
diff --git a/server/methods/core/orders.js b/server/methods/core/orders.js
index 460b676c0e1..c8f6b55d27a 100644
--- a/server/methods/core/orders.js
+++ b/server/methods/core/orders.js
@@ -26,7 +26,7 @@ import { Logger, Hooks, Reaction } from "/server/api";
* @return {Object} returns entire payment method
*/
export function orderCreditMethod(order) {
- const creditBillingRecords = order.billing.filter((value) => value.paymentMethod.method === "credit");
+ const creditBillingRecords = order.billing.filter((value) => value.paymentMethod.method === "credit");
const billingRecord = creditBillingRecords.find((billing) => billing.shopId === Reaction.getShopId());
return billingRecord;
}
@@ -40,7 +40,7 @@ export function orderCreditMethod(order) {
* @return {Object} returns entire payment method
*/
export function orderDebitMethod(order) {
- const debitBillingRecords = order.billing.filter((value) => value.paymentMethod.method === "debit");
+ const debitBillingRecords = order.billing.filter((value) => value.paymentMethod.method === "debit");
const billingRecord = debitBillingRecords.find((billing) => billing.shopId === Reaction.getShopId());
return billingRecord;
}
@@ -140,8 +140,8 @@ export function orderQuantityAdjust(orderId, refundedItem) {
Orders.update({
_id: orderId,
items: { $elemMatch: { _id: itemId } }
- }, { $set:
- { "items.$.quantity": newQuantity }
+ }, {
+ $set: { "items.$.quantity": newQuantity }
});
}
});
@@ -176,7 +176,8 @@ export const methods = {
}, {
$set: {
"shipping.$.workflow.status": "coreOrderWorkflow/picked"
- }, $push: {
+ },
+ $push: {
"shipping.$.workflow.workflow": "coreOrderWorkflow/picked"
}
});
@@ -214,7 +215,8 @@ export const methods = {
}, {
$set: {
"shipping.$.workflow.status": "coreOrderWorkflow/packed"
- }, $push: {
+ },
+ $push: {
"shipping.$.workflow.workflow": "coreOrderWorkflow/packed"
}
});
@@ -250,7 +252,8 @@ export const methods = {
}, {
$set: {
"shipping.$.workflow.status": "coreOrderWorkflow/labeled"
- }, $push: {
+ },
+ $push: {
"shipping.$.workflow.workflow": "coreOrderWorkflow/labeled"
}
});
@@ -510,7 +513,8 @@ export const methods = {
}, {
$set: {
"shipping.$.workflow.status": "coreOrderWorkflow/shipped"
- }, $push: {
+ },
+ $push: {
"shipping.$.workflow.workflow": "coreOrderWorkflow/shipped"
}
});
@@ -565,7 +569,8 @@ export const methods = {
}, {
$set: {
"shipping.$.workflow.status": "coreOrderWorkflow/delivered"
- }, $push: {
+ },
+ $push: {
"shipping.$.workflow.workflow": "coreOrderWorkflow/delivered"
}
});
@@ -612,7 +617,7 @@ export const methods = {
const mediaId = Media.findOne(brandAsset.mediaId);
emailLogo = path.join(Meteor.absoluteUrl(), mediaId.url());
} else {
- emailLogo = Meteor.absoluteUrl() + "resources/email-templates/shop-logo.png";
+ emailLogo = `${Meteor.absoluteUrl()}resources/email-templates/shop-logo.png`;
}
let subtotal = 0;
@@ -684,7 +689,7 @@ export const methods = {
combinedItems.push(orderItem);
// Placeholder image if there is no product image
- orderItem.placeholderImage = Meteor.absoluteUrl() + "resources/placeholder.gif";
+ orderItem.placeholderImage = `${Meteor.absoluteUrl()}resources/placeholder.gif`;
const variantImage = Media.findOne({
"metadata.productId": orderItem.productId,
@@ -722,17 +727,17 @@ export const methods = {
display: true,
facebook: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/facebook-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/facebook-icon.png`,
link: "https://www.facebook.com"
},
googlePlus: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/google-plus-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/google-plus-icon.png`,
link: "https://plus.google.com"
},
twitter: {
display: true,
- icon: Meteor.absoluteUrl() + "resources/email-templates/twitter-icon.png",
+ icon: `${Meteor.absoluteUrl()}resources/email-templates/twitter-icon.png`,
link: "https://www.twitter.com"
}
},
@@ -844,7 +849,7 @@ export const methods = {
"shipping._id": shipment._id
}, {
$set: {
- ["shipping.$.tracking"]: tracking
+ "shipping.$.tracking": tracking
}
});
},
diff --git a/server/methods/core/shop.js b/server/methods/core/shop.js
index 0b67b1d525a..c1b9cb43c67 100644
--- a/server/methods/core/shop.js
+++ b/server/methods/core/shop.js
@@ -92,7 +92,7 @@ Meteor.methods({
// ensure unique id and shop name
seedShop._id = Random.id();
- seedShop.name = seedShop.name + count;
+ seedShop.name += count;
// We trust the owner's shop clone, check only when shopData is passed as an argument
if (shopData) {
@@ -562,8 +562,8 @@ Meteor.methods({
*/
"shop/updateHeaderTags"(tagName, tagId, currentTagId) {
check(tagName, String);
- check(tagId, Match.OneOf(String, null, void 0));
- check(currentTagId, Match.OneOf(String, null, void 0));
+ check(tagId, Match.OneOf(String, null, undefined));
+ check(currentTagId, Match.OneOf(String, null, undefined));
let newTagId = {};
// must have 'core' permissions
diff --git a/server/publications/collections/orders-publications.app-test.js b/server/publications/collections/orders-publications.app-test.js
index 5563f94ebf5..11a52cabedc 100644
--- a/server/publications/collections/orders-publications.app-test.js
+++ b/server/publications/collections/orders-publications.app-test.js
@@ -53,11 +53,11 @@ describe("Order Publication", function () {
sandbox.stub(Collections.Orders._hookAspects.insert.before[0], "aspect");
sandbox.stub(Collections.Orders._hookAspects.update.before[0], "aspect");
sandbox.stub(Reaction, "hasPermission", () => true);
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function (...args) {
+ check(args, [Match.Any]);
});
sandbox.stub(Reaction, "getShopId", () => shop._id);
sandbox.stub(Roles, "userIsInRole", () => true);
@@ -75,11 +75,11 @@ describe("Order Publication", function () {
sandbox.stub(Collections.Orders._hookAspects.insert.before[0], "aspect");
sandbox.stub(Collections.Orders._hookAspects.update.before[0], "aspect");
sandbox.stub(Reaction, "hasPermission", () => true);
- sandbox.stub(Meteor.server.method_handlers, "inventory/register", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/register", function (...args) {
+ check(args, [Match.Any]);
});
- sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function () {
- check(arguments, [Match.Any]);
+ sandbox.stub(Meteor.server.method_handlers, "inventory/sold", function (...args) {
+ check(args, [Match.Any]);
});
sandbox.stub(Reaction, "getShopId", () => shop._id);
sandbox.stub(Roles, "userIsInRole", () => false);
diff --git a/server/publications/collections/packages.js b/server/publications/collections/packages.js
index 8310d0e5b4d..8c70413412c 100644
--- a/server/publications/collections/packages.js
+++ b/server/publications/collections/packages.js
@@ -41,7 +41,7 @@ function transform(doc, userId) {
// check and set package enabled state
registry.permissions = [...permissions];
if (registry.route) {
- registry.permissions.push(registry.name || doc.name + "/" + registry.template);
+ registry.permissions.push(registry.name || `${doc.name}/${registry.template}`);
}
if (doc.settings && doc.settings[registry.settingsKey]) {
registry.enabled = !!doc.settings[registry.settingsKey].enabled;
diff --git a/server/startup/accounts.js b/server/startup/accounts.js
index c02c68d9dec..e900b8b3518 100644
--- a/server/startup/accounts.js
+++ b/server/startup/accounts.js
@@ -203,7 +203,7 @@ export default function () {
$pullAll: {}
};
- update.$pullAll["roles." + Reaction.getShopId()] = ["anonymous"];
+ update.$pullAll[`roles.${Reaction.getShopId()}`] = ["anonymous"];
Meteor.users.update({
_id: options.user._id
@@ -211,8 +211,7 @@ export default function () {
multi: true
});
// debug info
- Logger.debug("removed anonymous role from user: " +
- options.user._id);
+ Logger.debug(`removed anonymous role from user: ${options.user._id}`);
// do not call `cart/mergeCart` on methodName === `createUser`, because
// in this case `cart/mergeCart` calls from cart publication
diff --git a/server/startup/i18n.js b/server/startup/i18n.js
index 93e5a8d8c43..e70d598f950 100644
--- a/server/startup/i18n.js
+++ b/server/startup/i18n.js
@@ -66,7 +66,7 @@ export function loadTranslations(sources) {
*/
export function loadCoreTranslations() {
- const meteorPath = fs.realpathSync(process.cwd() + "/../");
+ const meteorPath = fs.realpathSync(`${process.cwd()}/../`);
const i18nFolder = `${meteorPath}/server/assets/app/data/i18n/`;
if (directoryExists(i18nFolder)) {
@@ -97,7 +97,7 @@ export function loadCoreTranslations() {
// inserted using loadTranslation
// as well.
Assets.find({ type: "i18n" }).forEach((t) => {
- Logger.debug(`Importing ${t.name} translation for \"${t.ns}\"`);
+ Logger.debug(`Importing ${t.name} translation for "${t.ns}"`);
if (t.content) {
Reaction.Import.process(t.content, ["i18n"], Reaction.Import.translation);
} else {