-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace all Hooks with appEvents #4915
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
359bba0
feat: change all "afterAccountsUpdate" hooks to "afterAccountUpdate"
aldeed 4f7e821
feat: change afterAccountsInsert hook to afterAccountCreate app event
aldeed 84a8c97
feat: change afterAccountsRemove hook to afterAccountDelete app event
aldeed b95d418
feat: implement consistent afterOrderUpdate app event
aldeed 7f557d5
feat: replace afterRemoveProduct hook with afterProductDelete app event
aldeed 9abd2e8
feat: remove afterPublishProductToCatalog hook in favor of app event
aldeed 6b35364
fix: convert catalog hooks to app events
aldeed ba0943e
feat: remove afterSecurityInit hook
aldeed 92b8ba2
feat: remove onCreateUser hook
aldeed b24d254
feat: remove onLogin hook
aldeed 3e6d91e
feat: remove onImport hooks
aldeed 8c7f21a
feat: remove beforeCoreInit and onCoreInit hooks
aldeed e293c29
feat: implement a standard way for plugins to add roles to groups
aldeed 449faab
Merge branch 'develop' into feat-aldeed-remove-hooks
aldeed 1c0f5f6
refactor: convert hook to afterOrderPaymentCapture event
aldeed 4f8d003
refactor: refactor code and remove hooks
aldeed 8980ddd
refactor: remove unused "beforeUpdateOrderWorkflow" hook
aldeed 0f038a0
refactor: remove unused "afterInsertProduct" hook
aldeed ee04d50
refactor: convert "onJobServerStart" hook to "jobServerStart" app event
aldeed 6c7f223
refactor: remove unused "onOrderRefundCreated" hook
aldeed 4d65d8f
refactor: convert "afterCoreInit" hook to app event
aldeed a7c3e1f
refactor: replace "onGenerateSitemap" hook
aldeed 2d04fbd
feat: remove @reactioncommerce/hooks NPM package
aldeed 84efd7c
chore: remove never-used file
aldeed b579507
fix: await the findOne call
aldeed 53b6257
fix: convert missed "afterCoreInit" hook
aldeed 0cf7193
fix: add missing update selectors
aldeed 52b743b
test: attempt to fix timing failures of app tests
aldeed 6471d28
fix: update to bootstrap 3.4.0 to fix Snyk security warning
aldeed 6173c9c
fix: make updatedFields param optional
aldeed 1a1f6ea
feat: improve code in addressBookAdd
aldeed 9e749de
fix: check for address being removed
aldeed de278eb
Merge branch 'develop' into feat-aldeed-remove-hooks
aldeed 95dca1c
feat: remove MethodHooks feature
aldeed 7d0c0d2
feat: change updatedAccount arg to account for afterAccountUpdate
aldeed 1089250
feat: new and consistent arg for afterCartUpdate
aldeed 3aa20a7
feat: improved afterCartCreate args
aldeed 6b5f282
refactor: improved sendEmail event args
aldeed 433310d
feat: add createdBy to afterShopCreate emit args
aldeed 86fac68
refactor: update afterMedia event args
aldeed 3b2bfbd
feat: improved afterOrderApprovePayment event args
aldeed 3f25b85
feat: improved afterOrderCreate event args
aldeed 05fb5b8
feat: updated afterNotificationCreate event args
aldeed 80c3723
Merge branch 'develop' into feat-aldeed-remove-hooks
aldeed ab97849
fix: consume correct event
aldeed 425c43d
chore: fix lint
aldeed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,6 @@ | ||
import Hooks from "@reactioncommerce/hooks"; | ||
import Reaction from "/imports/plugins/core/core/server/Reaction"; | ||
import { Accounts, Groups } from "/lib/collections"; | ||
import { ENROLL_URI_BASE } from "./util/getDataForEmail"; | ||
import appEvents from "/imports/node-app/core/util/appEvents"; | ||
import sendVerificationEmail from "./util/sendVerificationEmail"; | ||
|
||
// set default admin user's account as "owner" | ||
Hooks.Events.add("afterCreateDefaultAdminUser", (user) => { | ||
const group = Groups.findOne({ slug: "owner", shopId: Reaction.getShopId() }); | ||
Accounts.update({ _id: user._id }, { $set: { groups: [group._id] } }); | ||
Hooks.Events.run("afterAccountsUpdate", null, { | ||
accountId: user._id, | ||
updatedFields: ["groups"] | ||
}); | ||
}); | ||
|
||
Hooks.Events.add("afterCoreInit", () => { | ||
Reaction.addRolesToGroups({ | ||
allShops: true, | ||
groups: ["guest", "customer"], | ||
roles: ["account/verify", "reset-password", ENROLL_URI_BASE] | ||
}); | ||
appEvents.on("afterAddUnverifiedEmailToUser", ({ email, userId }) => { | ||
sendVerificationEmail(userId, email); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check that
updatedAccount.profile.addressBook
exists here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same answer