Skip to content

Commit

Permalink
Merge pull request #2937 from reactioncommerce/wanja-fix-issue-2928
Browse files Browse the repository at this point in the history
Fix alerts for confirmation when inviting new user
  • Loading branch information
mikemurray authored Sep 28, 2017
2 parents 727f30f + dd4f432 commit acd18ef
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from "prop-types";
import _ from "lodash";
import { Components, registerComponent } from "@reactioncommerce/reaction-components";
import { default as ReactionAlerts } from "/imports/plugins/core/layout/client/templates/layout/alerts/inlineAlerts";
import { Reaction } from "/client/api";
import { Reaction, i18next } from "/client/api";
import { getDefaultUserInviteGroup } from "../helpers/accountsHelper";

class AdminInviteForm extends Component {
Expand Down Expand Up @@ -73,6 +73,8 @@ class AdminInviteForm extends Component {
messageKey = "admin.groupsInvite.inviteOwnerError";
} else if (error.reason === "cannot invite to group") {
messageKey = "admin.groupsInvite.cannotInvite";
} else if (error.reason === "Need to set a username or email") {
messageKey = "admin.groupsInvite.NeedToSetUsernameOrEmail";
} else {
messageKey = "admin.groupsInvite.errorSendingInvite";
}
Expand All @@ -81,11 +83,7 @@ class AdminInviteForm extends Component {

if (result) {
this.setState({ name: "", email: "" });
ReactionAlerts.add(
"Invite Successful",
"success",
Object.assign({}, alertOptions, { i18nKey: "accountsUI.info.invitationSent" })
);
Alerts.toast(i18next.t("accountsUI.info.invitationSent"), "success");
}
});
}
Expand Down
3 changes: 2 additions & 1 deletion imports/plugins/core/accounts/server/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"groupRequired": "A group is required to invite an admin",
"cannotInvite": "You cannot invite to group",
"unableToSendInvitationEmail": "Unable to send invitation email",
"errorSendingInvite": "An error occured while sending invite"
"errorSendingInvite": "An error occured while sending invite",
"NeedToSetUsernameOrEmail": "Need to set a username or email"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}
.col-md-3 {
.alert-container {
position: absolute;
position: relative;
top: 0;
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Meteor } from "meteor/meteor";
import React, { Component } from "react";
import { registerComponent, Components } from "@reactioncommerce/reaction-components";
import { i18next } from "/client/api";
import { default as ReactionAlerts } from "/imports/plugins/core/layout/client/templates/layout/alerts/inlineAlerts";

class InviteOwner extends Component {
Expand Down Expand Up @@ -49,11 +50,7 @@ class InviteOwner extends Component {

if (result) {
this.setState({ name: "", email: "" });
ReactionAlerts.add(
null,
"success",
Object.assign({}, alertOptions, { i18nKey: "accountsUI.info.invitationSent" })
);
Alerts.toast(i18next.t("accountsUI.info.invitationSent"), "success");
}
});
}
Expand Down

0 comments on commit acd18ef

Please sign in to comment.