public static bool MatchesOptions(this MergeRequestInfo mergeRequest, GetMergeRequestsOptions mergeRequestsOptions) { if (mergeRequestsOptions.ExcludingProjectIds != null) { if (mergeRequestsOptions.ExcludingProjectIds.Contains(mergeRequest.ProjectId)) { return(false); } } if (mergeRequestsOptions.AuthorUsername != null) { if (mergeRequest.AuthorUsername != mergeRequestsOptions.AuthorUsername) { return(false); } } if (mergeRequestsOptions.NotAuthoredBy != null) { if (mergeRequest.AuthorUsername == mergeRequestsOptions.NotAuthoredBy) { return(false); } } if (mergeRequestsOptions.OnlyNotInProgress) { if (mergeRequest.IsWorkInProgress) { return(false); } } if (mergeRequestsOptions.OnlyOpened == true && !mergeRequest.IsOpened) { return(false); } if (mergeRequestsOptions.NotUpvotedBy != null) { if (mergeRequest.UpvotedBy.Contains(mergeRequestsOptions.NotUpvotedBy)) { return(false); } } return(true); }
private void BtnApproveClick(object sender, EventArgs e) { var curItem = lbxPullRequests.SelectedItem as PullRequest; var mergeInfo = new MergeRequestInfo { Id = curItem.Id, Version = curItem.Version, ProjectKey = curItem.DestProjectKey, TargetRepo = curItem.DestRepo, }; //Approve var approveRequest = new ApprovePullRequest(_settings, mergeInfo); var response = approveRequest.Send(); if (response.Success) { MessageBox.Show("Success"); StashViewPullRequestFormLoad(null, null); } else MessageBox.Show(string.Join(Environment.NewLine, response.Messages), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }