Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
9738c2f
Whitespace change.
grokys Feb 15, 2018
ddbe030
Merge branch 'master' into feature/pr-reviews-master
grokys Mar 16, 2018
69a6126
Removed unused InlineReviews code.
grokys Feb 21, 2018
9dd5976
Removed unused IInlineCommentModel.
grokys Mar 16, 2018
7300754
Merge pull request #1500 from github/refactor/remove-unused-inlinerev…
jcansdale Mar 16, 2018
f72df0c
Moved changed files tree into its own view.
grokys Feb 15, 2018
6123b02
Use the `ghfvs:` xmlns where possible.
grokys Mar 16, 2018
b203545
Port changes from #1407.
grokys Feb 15, 2018
d51f5f5
Added GraphQL to GitHub.Api.
grokys Feb 21, 2018
7799ed5
Use GraphQL to read PR reviews/comments.
grokys Feb 21, 2018
cd366cf
Need to force-add the .nupkg.
grokys Feb 21, 2018
d246220
Fix PR review comments cursor bug.
grokys Feb 21, 2018
0a20262
Add binding redirect for Newtonsoft.Json...
grokys Feb 21, 2018
fc38e0b
Unindent #region.
grokys Mar 19, 2018
1fcd815
Try to explain GraphQL paging.
grokys Mar 19, 2018
cb0d491
Use GraphQL to read PR reviews/comments.
grokys Feb 21, 2018
9353f41
Update octokit.net to 0.29.0
grokys Mar 6, 2018
5af3529
Unindent #region.
grokys Mar 19, 2018
68e3e4c
Moved changed files tree into its own view.
grokys Feb 15, 2018
38ac072
Port changes from #1407.
grokys Feb 15, 2018
e8cb2a9
Use GraphQL to read PR reviews/comments.
grokys Feb 21, 2018
be15e94
Fix dark theme foreground color.
grokys Mar 1, 2018
98e8241
Removed unused commands.
grokys Mar 6, 2018
c8d2b53
Add "Reviewers" section to PR details.
grokys Mar 6, 2018
6369185
Use resource for pending review b/g.
grokys Mar 6, 2018
2de559a
Removed unused code.
grokys Mar 6, 2018
b04ef76
Fix broken tests.
grokys Mar 6, 2018
8fa6723
Update pending reivew bg color on dark theme
donokuda Mar 13, 2018
8b6a424
Don't show other users' pending reviews.
grokys Mar 14, 2018
7c789ae
Merge branch 'refactor/pullrequestfilesviewmodel' into feature/pr-det…
grokys Mar 19, 2018
f0fca86
Fix broken merge.
grokys Mar 19, 2018
cbb529a
Ported changes from #1533.
grokys Mar 19, 2018
87dd7ab
Fix GitHubPane route regex.
grokys Mar 19, 2018
0c86084
Added IModelService.GetUser
grokys Mar 19, 2018
44adbb3
Fix dark theme foreground color.
grokys Mar 19, 2018
f215aeb
Added TrimNewlinesConverter.
grokys Mar 19, 2018
b35ddfc
Added TrimmedPathTextBlock.
grokys Mar 19, 2018
8d8b7c7
Restyle expander
grokys Mar 19, 2018
d5ac99a
Display user reviews.
grokys Mar 19, 2018
6297f67
Added PullRequestUserReviewsViewModel tests.
grokys Mar 19, 2018
6f783d2
Don't gray out disabled expander headers.
grokys Mar 20, 2018
6efaefe
Added PullRequestReviewViewModel tests.
grokys Mar 20, 2018
9434e9b
Read Review SubmittedAt.
grokys Mar 20, 2018
57ca891
Hide empty review details.
grokys Mar 20, 2018
9f70ca9
Restyle Expander button.
grokys Mar 20, 2018
68edb71
Ported changes from #1543.
grokys Mar 20, 2018
be015f4
Fix CA errors.
grokys Mar 20, 2018
fa8aab8
Display PR review comment inline.
grokys Mar 21, 2018
47ccd4c
Removed unneeded method.
grokys Mar 21, 2018
c301d4f
Display PR review authoring view.
grokys Mar 21, 2018
be8fb3f
Added reviews capability to the the PR session.
grokys Mar 22, 2018
f67582d
Allow starting a review from and inline comment.
grokys Mar 23, 2018
2360038
Remove pending badge from comment when review submitted.
grokys Mar 23, 2018
b95d370
Update PR details when review submitted.
grokys Mar 23, 2018
31cdd81
Merge pull request #1492 from github/refactor/pullrequestfilesviewmodel
jcansdale Mar 23, 2018
05dd045
Merge branch 'feature/pr-reviews-master' into feature/graphql-modelse…
grokys Mar 23, 2018
c0e02a8
:fire: Reviewer meta data
donokuda Mar 26, 2018
e3f94b3
Make the name bold, but not too bold
donokuda Mar 26, 2018
4e69c17
Add PR reviews metrics.
grokys Mar 27, 2018
774fa48
Merge pull request #1501 from github/feature/graphql-modelservice-pr-…
jcansdale Mar 28, 2018
f75bea3
Merge pull request #1521 from github/update/octokit-to-0.29.0
jcansdale Mar 28, 2018
d57692b
Don't retain placeholder when starting a review.
grokys Mar 28, 2018
33f42dc
Merge branch 'feature/pr-review-authoring' into feature/pr-review-met…
grokys Mar 28, 2018
20bd34e
Merge branch 'feature/pr-reviews-master' into feature/pr-details-revi…
grokys Mar 29, 2018
f799990
Merge branch 'feature/pr-details-review-list' into feature/pr-user-re…
grokys Mar 29, 2018
13c0131
Merge branch 'feature/pr-user-reviews' into feature/show-pr-user-revi…
grokys Mar 29, 2018
3ef2f07
Merge branch 'feature/show-pr-user-review-comments-in-editor' into fe…
grokys Mar 29, 2018
e1f401e
Merge branch 'feature/pr-review-authoring' into feature/pr-review-met…
grokys Mar 29, 2018
3ba7773
Updated version to 2.4.99.
grokys Mar 29, 2018
f629007
Add ability to cancel a PR review.
grokys Mar 30, 2018
1f4f82b
Use correct GraphQL endpoint for enterprise.
grokys Apr 3, 2018
c917d44
Fix navigate to editor.
grokys Apr 3, 2018
106487f
Don't ignore .nupkg files in lib.
grokys Apr 4, 2018
9c36a14
Update octokit.graphql to 0.0.2.
grokys Apr 4, 2018
9189d6b
Fix navigate from 'View File' to editor
jcansdale Apr 4, 2018
443ad2a
Merge pull request #1523 from github/feature/pr-details-review-list
jcansdale Apr 4, 2018
1a867f8
Validate PR review state before submit.
grokys Apr 4, 2018
a4fe246
Make GetAbsolutePath use Windows '\' separator
jcansdale Apr 4, 2018
24dec7d
Reuse existing diff tabs.
grokys Apr 5, 2018
223e904
Keep things DRY.
grokys Apr 5, 2018
e89145e
Allow request changes with only file comments.
grokys Apr 5, 2018
41850a9
Fix CA errors.
grokys Apr 5, 2018
02427b6
Make avatar in PR review summary clickable.
grokys Apr 5, 2018
ca0a9d3
Tweaked comments.
grokys Apr 5, 2018
d084591
Set GitHubActionLink.Opacity on disabled.
grokys Apr 9, 2018
bff9aac
Merge pull request #1545 from github/feature/pr-user-reviews
grokys Apr 9, 2018
94205d8
Merge pull request #1549 from github/feature/show-pr-user-review-comm…
jcansdale Apr 9, 2018
bb8d412
Merge pull request #1562 from github/feature/pr-review-authoring
jcansdale Apr 9, 2018
b4cf1d0
Merge pull request #1567 from github/feature/pr-review-metrics
jcansdale Apr 9, 2018
06cfa75
Merge branch 'feature/pr-reviews-master' into fixes/cancel-pr-review
jcansdale Apr 10, 2018
b32cb7d
Merge pull request #1572 from github/fixes/cancel-pr-review
jcansdale Apr 10, 2018
86c7f1b
Merge pull request #1578 from github/fixes/graphql-enterprise
jcansdale Apr 10, 2018
d74fa01
Merge pull request #1580 from github/fixes/navigate-to-editor
jcansdale Apr 10, 2018
8cfef76
Merge pull request #1581 from github/fixes/graphql-escaping
jcansdale Apr 10, 2018
a96fd8f
Merge pull request #1582 from github/fixes/pr-authoring-command-valid…
jcansdale Apr 10, 2018
aa6dbc1
Merge pull request #1585 from github/fixes/reuse-existing-diff-tab
jcansdale Apr 10, 2018
cef9124
Merge pull request #1586 from github/fixes/make-review-avatar-clickable
jcansdale Apr 10, 2018
ac0116f
Show navigate to editor hint on status bar
jcansdale Apr 10, 2018
39e911e
Show different message when PR not checked out
jcansdale Apr 10, 2018
39fb3be
Add NavigateToEditorNotCheckedOutInfoMessage resource
jcansdale Apr 10, 2018
2b46a6c
Fix compile errors after rebase
jcansdale Apr 10, 2018
1c7bd8d
Update wording when PR branch not checked out
jcansdale Apr 10, 2018
70c283e
Show status bar hint when using View File
jcansdale Apr 10, 2018
be6c2b8
Merge branch 'master' into feature/pr-reviews-master
jcansdale Apr 10, 2018
6d64a43
Merge branch 'master' into feature/pr-reviews-master
jcansdale Apr 11, 2018
a3bd375
Fix merge error.
grokys Apr 12, 2018
692beca
Merge branch 'master' into feature/pr-reviews-master
grokys Apr 12, 2018
4174562
Merge branch 'master' into feature/pr-reviews-master
jcansdale Apr 13, 2018
c2b105e
Merge pull request #1552 from github/fixes/1546-make-navigate-to-edit…
jcansdale Apr 16, 2018
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ Visit the [Contributor Guidelines](CONTRIBUTING.md) for details on how to contri
Copyright 2015 - 2017 GitHub, Inc.

Licensed under the [MIT License](LICENSE.md)

2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.4.4.{build}'
version: '2.4.99.{build}'
skip_tags: true
install:
- ps: |
Expand Down
1 change: 1 addition & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.nupkg
Binary file added lib/Octokit.GraphQL.0.0.2-alpha.nupkg
Binary file not shown.
15 changes: 15 additions & 0 deletions src/GitHub.Api/GitHub.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
</PropertyGroup>
<Import Project="$(SolutionDir)\src\common\signing.props" />
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Octokit.GraphQL, Version=0.0.2.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.0.2-alpha\lib\netstandard1.1\Octokit.GraphQL.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Octokit.GraphQL.Core, Version=0.0.2.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.0.2-alpha\lib\netstandard1.1\Octokit.GraphQL.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\..\packages\Serilog.2.5.0\lib\net46\Serilog.dll</HintPath>
<Private>True</Private>
Expand All @@ -66,6 +78,9 @@
<Link>ApiClientConfiguration_User.cs</Link>
</Compile>
<Compile Include="ApiClientConfiguration_User.cs" Condition="$(Buildtype) != 'Internal'" />
<Compile Include="GraphQLKeychainCredentialStore.cs" />
<Compile Include="IGraphQLClientFactory.cs" />
<Compile Include="GraphQLClientFactory.cs" />
<Compile Include="IKeychain.cs" />
<Compile Include="ILoginManager.cs" />
<Compile Include="IOAuthCallbackListener.cs" />
Expand Down
41 changes: 41 additions & 0 deletions src/GitHub.Api/GraphQLClientFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using GitHub.Models;
using GitHub.Primitives;
using Octokit.GraphQL;

namespace GitHub.Api
{
/// <summary>
/// Creates GraphQL <see cref="Octokit.GraphQL.IConnection"/>s for querying the
/// GitHub GraphQL API.
/// </summary>
[Export(typeof(IGraphQLClientFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class GraphQLClientFactory : IGraphQLClientFactory
{
readonly IKeychain keychain;
readonly IProgram program;

/// <summary>
/// Initializes a new instance of the <see cref="GraphQLClientFactory"/> class.
/// </summary>
/// <param name="keychain">The <see cref="IKeychain"/> to use.</param>
/// <param name="program">The program details.</param>
[ImportingConstructor]
public GraphQLClientFactory(IKeychain keychain, IProgram program)
{
this.keychain = keychain;
this.program = program;
}

/// <inheirtdoc/>
public Task<Octokit.GraphQL.IConnection> CreateConnection(HostAddress address)
{
var credentials = new GraphQLKeychainCredentialStore(keychain, address);
var header = new ProductHeaderValue(program.ProductHeader.Name, program.ProductHeader.Version);
return Task.FromResult<Octokit.GraphQL.IConnection>(new Connection(header, address.GraphQLUri, credentials));
}
}
}
32 changes: 32 additions & 0 deletions src/GitHub.Api/GraphQLKeychainCredentialStore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Threading.Tasks;
using GitHub.Extensions;
using GitHub.Primitives;
using Octokit.GraphQL;

namespace GitHub.Api
{
/// <summary>
/// An Octokit.GraphQL credential store that reads from an <see cref="IKeychain"/>.
/// </summary>
public class GraphQLKeychainCredentialStore : ICredentialStore
{
readonly IKeychain keychain;
readonly HostAddress address;

public GraphQLKeychainCredentialStore(IKeychain keychain, HostAddress address)
{
Guard.ArgumentNotNull(keychain, nameof(keychain));
Guard.ArgumentNotNull(address, nameof(keychain));

this.keychain = keychain;
this.address = address;
}

public async Task<string> GetCredentials()
{
var userPass = await keychain.Load(address).ConfigureAwait(false);
return userPass?.Item2;
}
}
}
19 changes: 19 additions & 0 deletions src/GitHub.Api/IGraphQLClientFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Threading.Tasks;
using GitHub.Primitives;

namespace GitHub.Api
{
/// <summary>
/// Creates GraphQL <see cref="Octokit.GraphQL.IConnection"/>s for querying the
/// GitHub GraphQL API.
/// </summary>
public interface IGraphQLClientFactory
{
/// <summary>
/// Creates a new <see cref="Octokit.GraphQL.IConnection"/>.
/// </summary>
/// <param name="address">The address of the server.</param>
/// <returns>A task returning the created connection.</returns>
Task<Octokit.GraphQL.IConnection> CreateConnection(HostAddress address);
}
}
2 changes: 2 additions & 0 deletions src/GitHub.Api/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
<package id="Octokit.GraphQL" version="0.0.2-alpha" targetFramework="net461" />
<package id="Serilog" version="2.5.0" targetFramework="net461" />
</packages>
56 changes: 29 additions & 27 deletions src/GitHub.App/Api/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@ public IObservable<Repository> CreateRepository(NewRepository repository, string
return (isUser ? client.Create(repository) : client.Create(login, repository));
}

public IObservable<PullRequestReview> PostPullRequestReview(
string owner,
string name,
int number,
string commitId,
string body,
PullRequestReviewEvent e)
{
Guard.ArgumentNotEmptyString(owner, nameof(owner));
Guard.ArgumentNotEmptyString(name, nameof(name));

var review = new PullRequestReviewCreate
{
Body = body,
CommitId = commitId,
Event = e,
};

return gitHubClient.PullRequest.Review.Create(owner, name, number, review);
}

public IObservable<PullRequestReviewComment> CreatePullRequestReviewComment(
string owner,
string name,
Expand Down Expand Up @@ -88,6 +109,11 @@ public IObservable<User> GetUser()
return gitHubClient.User.Current();
}

public IObservable<User> GetUser(string login)
{
return gitHubClient.User.Get(login);
}

public IObservable<Organization> GetOrganizations()
{
// Organization.GetAllForCurrent doesn't return all of the information we need (we
Expand Down Expand Up @@ -123,30 +149,10 @@ public IObservable<LicenseMetadata> GetLicenses()

public HostAddress HostAddress { get; }

static string GetSha256Hash(string input)
{
Guard.ArgumentNotEmptyString(input, nameof(input));

try
{
using (var sha256 = SHA256.Create())
{
var bytes = Encoding.UTF8.GetBytes(input);
var hash = sha256.ComputeHash(bytes);

return string.Join("", hash.Select(b => b.ToString("x2", CultureInfo.InvariantCulture)));
}
}
catch (Exception e)
{
log.Error(e, "IMPOSSIBLE! Generating Sha256 hash caused an exception");
return null;
}
}

static string GetFingerprint()
{
return GetSha256Hash(ProductName + ":" + GetMachineIdentifier());
var fingerprint = ProductName + ":" + GetMachineIdentifier();
return fingerprint.GetSha256Hash();
}

static string GetMachineNameSafe()
Expand Down Expand Up @@ -269,11 +275,7 @@ public IObservable<Branch> GetBranches(string owner, string repo)
Guard.ArgumentNotEmptyString(owner, nameof(owner));
Guard.ArgumentNotEmptyString(repo, nameof(repo));

#pragma warning disable 618
// GetAllBranches is obsolete, but don't want to introduce the change to fix the
// warning in the PR, so disabling for now.
return gitHubClient.Repository.GetAllBranches(owner, repo);
#pragma warning restore
return gitHubClient.Repository.Branch.GetAll(owner, repo);
}

public IObservable<Repository> GetRepository(string owner, string repo)
Expand Down
5 changes: 5 additions & 0 deletions src/GitHub.App/Factories/ModelServiceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using GitHub.Api;
using GitHub.Caches;
using GitHub.Models;
using GitHub.Services;
Expand All @@ -15,6 +16,7 @@ namespace GitHub.Factories
public sealed class ModelServiceFactory : IModelServiceFactory, IDisposable
{
readonly IApiClientFactory apiClientFactory;
readonly IGraphQLClientFactory graphQLClientFactory;
readonly IHostCacheFactory hostCacheFactory;
readonly IAvatarProvider avatarProvider;
readonly Dictionary<IConnection, ModelService> cache = new Dictionary<IConnection, ModelService>();
Expand All @@ -23,10 +25,12 @@ public sealed class ModelServiceFactory : IModelServiceFactory, IDisposable
[ImportingConstructor]
public ModelServiceFactory(
IApiClientFactory apiClientFactory,
IGraphQLClientFactory graphQLClientFactory,
IHostCacheFactory hostCacheFactory,
IAvatarProvider avatarProvider)
{
this.apiClientFactory = apiClientFactory;
this.graphQLClientFactory = graphQLClientFactory;
this.hostCacheFactory = hostCacheFactory;
this.avatarProvider = avatarProvider;
}
Expand All @@ -43,6 +47,7 @@ public async Task<IModelService> CreateAsync(IConnection connection)
{
result = new ModelService(
await apiClientFactory.Create(connection.HostAddress),
await graphQLClientFactory.CreateConnection(connection.HostAddress),
await hostCacheFactory.Create(connection.HostAddress),
avatarProvider);
result.InsertUser(AccountCacheItem.Create(connection.User));
Expand Down
Loading