Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

[WIP] Query the pull request using the GraphQL search connection #2262

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
364 changes: 200 additions & 164 deletions src/GitHub.App/Services/PullRequestService.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,6 @@ bool FilterItem(object o)
}
}

if (result && AuthorFilter.Selected != null)
{
result = item.Author.Login.Equals(
AuthorFilter.Selected.Login,
StringComparison.CurrentCultureIgnoreCase);
}

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,15 @@ protected override async Task<Page<PullRequestListItemModel>> LoadPage(string af
break;
}

var authorLogin = owner.AuthorFilter.Selected?.Login;

var result = await owner.service.ReadPullRequests(
HostAddress.Create(owner.RemoteRepository.CloneUrl),
owner.RemoteRepository.Owner,
owner.RemoteRepository.Name,
after,
states).ConfigureAwait(false);
states,
authorLogin).ConfigureAwait(false);
return result;
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/GitHub.Exports.Reactive/Services/IPullRequestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ public interface IPullRequestService : IIssueishService
/// <param name="name">The repository name.</param>
/// <param name="after">The end cursor of the previous page, or null for the first page.</param>
/// <param name="states">The pull request states to filter by</param>
/// <param name="author"></param>
/// <returns>A page of pull request item models.</returns>
Task<Page<PullRequestListItemModel>> ReadPullRequests(
HostAddress address,
Task<Page<PullRequestListItemModel>> ReadPullRequests(HostAddress address,
string owner,
string name,
string after,
PullRequestState[] states);
PullRequestState[] states,
string author);

/// <summary>
/// Reads a page of users that can be assigned to pull requests.
Expand Down
1 change: 1 addition & 0 deletions src/GitHub.Exports/Models/PullRequestListItemModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;

namespace GitHub.Models
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected static IPullRequestSessionManager CreateSessionManager(PullRequestDeta
protected static IPullRequestService CreatePullRequestService(int itemCount = 10)
{
var result = Substitute.For<IPullRequestService>();
result.ReadPullRequests(null, null, null, null, null).ReturnsForAnyArgs(
result.ReadPullRequests(null, null, null, null, null, null).ReturnsForAnyArgs(
new Page<PullRequestListItemModel>
{
Items = Enumerable.Range(0, itemCount).Select(x => new PullRequestListItemModel
Expand Down