Skip to content

Commit

Permalink
Merge branch 'develop' into feat-aldeed-demeteor-accounts-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aldeed committed Oct 8, 2019
2 parents 34fbbd1 + ba8a7f0 commit 34d36ae
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 28 deletions.
10 changes: 5 additions & 5 deletions imports/node-app/core-services/account/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function startup(context) {
});

appEvents.on("afterShopCreate", async (payload) => {
const { shop } = payload;
const { shop, shopAdminUserId } = payload;
let { createdBy: userId } = payload;
const { _id: newShopId, shopType } = shop;

Expand Down Expand Up @@ -64,10 +64,10 @@ export default async function startup(context) {
}

// If a user created the shop, give the user owner access to it
if (userId) {
if (shopAdminUserId) {
// Add users to roles
await users.updateOne({
_id: userId
_id: shopAdminUserId
}, {
$addToSet: {
[`roles.${newShopId}`]: {
Expand All @@ -77,7 +77,7 @@ export default async function startup(context) {
});

// Set the active shopId for this user
await Accounts.updateOne({ userId }, {
await Accounts.updateOne({ shopAdminUserId }, {
$set: {
"profile.preferences.reaction.activeShopId": newShopId,
"shopId": newShopId
Expand All @@ -87,7 +87,7 @@ export default async function startup(context) {
}
});

const updatedAccount = await Accounts.findOne({ userId });
const updatedAccount = await Accounts.findOne({ shopAdminUserId });
Promise.await(appEvents.emit("afterAccountUpdate", {
account: updatedAccount,
updatedBy: userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default function createShop(shopAdminUserId, partialShopData) {
// we should have created new shop, or erred
Logger.info("Created shop: ", newShopId);

Promise.await(appEvents.emit("afterShopCreate", { createdBy: userId, shop: newShop }));
Promise.await(appEvents.emit("afterShopCreate", { createdBy: userId, shop: newShop, shopAdminUserId: shopAdminUserId || userId }));

// Add this shop to the merchant
Shops.update({ _id: primaryShopId }, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ function ProductTable({ history }) {
onDrop,
multiple: true,
disablePreview: true,
accept: "text/csv",
disableClick: true
});

Expand Down
23 changes: 3 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"react-dnd": "^7.0.1",
"react-dnd-html5-backend": "^7.0.1",
"react-dom": "16.8.6",
"react-dropzone": "^10.1.7",
"react-dropzone": "^10.1.10",
"react-helmet": "^5.2.0",
"react-image-magnify": "^2.7.4",
"react-loadable": "^5.5.0",
Expand Down

0 comments on commit 34d36ae

Please sign in to comment.