Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kieckhafer
Copy link
Member

Resolves parts of #5529
Impact: minor
Type: feature|refactor

Issue

An app event which sends an email, afterAddUnverifiedEmailToUser, is being called inside a Meteor.startup file. In our effort to remove getGraphQLContextInMeteorMethod, we need to move this outside of meteor and into the no-meteor/startup file.

Solution

Move the afterAddUnverifiedEmailToUser appEvent call into the no-meteor/startup file. This also entailed writing a removeAccountEmailRecord GraphQL mutation. There was a pre-existing mutation schema, so the new mutation is based off this. This also entailed updating the Reaction Admin client UI to use this new mutation where applicable.

Breaking changes

Any custom code using the accounts/removeEmailAddress meteor method will need to be updated to use the new GraphQL mutation.

Testing

  1. Start the app, login as an admin
  2. Use the dropdown at the top right of the screen to view your profile
  3. Change your email address on this page. This will call the new mutation as part of the old email address removal.

Signed-off-by: Erik Kieckhafer <[email protected]>

refactor: configure url

Signed-off-by: Erik Kieckhafer <[email protected]>

refactor: configure url

Signed-off-by: Erik Kieckhafer <[email protected]>

refactor: pass shopId to email util

Signed-off-by: Erik Kieckhafer <[email protected]>
@kieckhafer kieckhafer requested a review from aldeed September 23, 2019 22:10
appEvents.on("afterAddUnverifiedEmailToUser", ({ email, userId }) => {
sendVerificationEmail({ email, userId });
});
import generateVerificationTokenObject from "/imports/plugins/core/accounts/server/no-meteor/util/generateVerificationTokenObject";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be refactored very soon in the PR moving accounts registration out of here.

const token = Random.secret();
const when = new Date();
const tokenObj = { token, email, when };
const tokenObj = generateVerificationTokenObject({ email });
Copy link
Member Author

@kieckhafer kieckhafer Sep 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aldeed I removed this file in #5558 a few days ago, but it's been re-added by PR #5556, which you recently merged from the community. It was strange timing with my PR and that PR, and the rebasing inside #5556 probably just re-added it by accident.

Just want to make sure that it's OK to re-delete this file and it wasn't re-added on purpose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kieckhafer There were conflicts when I merged that PR and I must have resolved them incorrectly. Make sure any changes from #5556 are in your non-Meteor version of the function, but otherwise OK to re-delete.

@kieckhafer
Copy link
Member Author

kieckhafer commented Sep 24, 2019

@aldeed all comments addressed

@aldeed aldeed merged commit de12373 into develop Sep 26, 2019
@aldeed aldeed deleted the refactor-kieckhafer-emailSendingInInit branch September 26, 2019 14:15
@kieckhafer kieckhafer mentioned this pull request Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants