コード例 #1
0
  @Override
  public void sendInvite(final String email) {
    if (email == null || email.isEmpty()) {
      ProfileGinjector.get
          .instance()
          .getNotifier()
          .displayMessage(Message.createErrorMessage("Please enter an email"));
      return;
    } else if (!ValidationUtils.isValidEmail(email)) {
      ProfileGinjector.get
          .instance()
          .getNotifier()
          .displayMessage(Message.createErrorMessage("Please enter a valid email"));
      return;
    }

    ProfileEntryPoint.getInstance()
        .getProfileService()
        .inviteUserForProject(
            email,
            project.getIdentifier(),
            new AsyncCallbackSupport<Void>() {

              @Override
              protected void success(Void result) {
                // Set a status message indicating that this user was invited
                view.inviteEmail.setText("");
                ProfileGinjector.get
                    .instance()
                    .getNotifier()
                    .displayMessage(
                        Message.createSuccessMessage("Invitation email sent to " + email));
              }
            });
  }
コード例 #2
0
  @Override
  protected void handleBatchResults() {
    super.handleBatchResults();
    tokenRequired = getResult(GetSignupTokenRequiredResult.class).get();

    GetSignupTokenResult signupTokenResult = getResult(GetSignupTokenResult.class);
    if (signupTokenResult != null) {
      signUpTokenData = signupTokenResult.get();
    }
    GetProjectInvitationTokenResult projectTokenResult =
        getResult(GetProjectInvitationTokenResult.class);
    if (projectTokenResult != null) {
      projectInvitationTokenData = projectTokenResult.get();
    }
    GetProjectResult projectResult = getResult(GetProjectResult.class);
    if (projectResult != null) {
      projectForInvitationToken = projectResult.get();
      postSignUpPlace = ProjectInvitationPlace.createPlace(signUpToken);
    }
    GetProfileResult gitHubProfileResult = getResult(GetProfileResult.class);
    if (gitHubProfileResult != null) {
      githubProfile = gitHubProfileResult.get();
    }

    if (tokenRequired && !StringUtils.hasText(signUpToken)) {
      ProfileGinjector.get
          .instance()
          .getPlaceProvider()
          .getDefaultPlace()
          .displayOnArrival(Message.createErrorMessage(profileMessages.tokenRequiredForSignUp()))
          .go();
      return;
    } else if (tokenRequired && projectInvitationTokenData == null && signUpTokenData == null) {
      ProfileGinjector.get
          .instance()
          .getPlaceProvider()
          .getDefaultPlace()
          .displayOnArrival(Message.createErrorMessage(profileMessages.invitationTokenNotValid()))
          .go();
      return;
    }

    onPlaceDataFetched();
  }