satellite/console,web/satellite: always notify when adding project members

Upon adding members to a project using the Add Team Member modal,
users are now notified that only email addresses belonging to an
account will receive a project invitation. This notification appears
regardless of whether every submitted email corresponds to an account.
Previously, users received an error message if any email address not
attached to an account was submitted.

Change-Id: Ia014c8311c1347e001b1c6c33de73ea61f20b0cb
This commit is contained in:
Jeremy Wharton 2022-11-08 21:16:02 -06:00 committed by Storj Robot
parent 553c1558a5
commit 3c8facfe58
3 changed files with 7 additions and 12 deletions

View File

@ -548,7 +548,7 @@ func TestProjects(t *testing.T) {
__typename
}
}`}))
require.Contains(t, body, "There is no account on this Satellite for the user(s) you have entered")
require.Contains(t, body, "addProjectMembers")
require.Equal(t, http.StatusOK, resp.StatusCode)
}

View File

@ -1829,6 +1829,7 @@ func (s *Service) GenUpdateProject(ctx context.Context, projectID uuid.UUID, pro
}
// AddProjectMembers adds users by email to given project.
// Email addresses not belonging to a user are ignored.
func (s *Service) AddProjectMembers(ctx context.Context, projectID uuid.UUID, emails []string) (users []*User, err error) {
defer mon.Task()(&ctx)(&err)
user, err := s.getUserAndAuditLog(ctx, "add project members", zap.String("projectID", projectID.String()), zap.Strings("emails", emails))
@ -1840,21 +1841,15 @@ func (s *Service) AddProjectMembers(ctx context.Context, projectID uuid.UUID, em
return nil, Error.Wrap(err)
}
var userErr errs.Group
// collect user querying errors
for _, email := range emails {
user, err := s.store.Users().GetByEmail(ctx, email)
if err != nil {
userErr.Add(err)
continue
}
if err == nil {
users = append(users, user)
} else if !errs.Is(err, sql.ErrNoRows) {
return nil, Error.Wrap(err)
}
if err = userErr.Err(); err != nil {
return nil, ErrValidation.New(teamMemberDoesNotExistErrMsg)
}
// add project members in transaction scope

View File

@ -188,7 +188,7 @@ export default class AddTeamMemberModal extends Vue {
return;
}
await this.$notify.success('Members successfully added to project!');
await this.$notify.notify(`The user(s) you've invited to your project will receive your invitation if they have an account on this satellite.`);
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
try {