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

Master PR for Pull Request Reviews #1491

Merged
merged 109 commits into from
Apr 16, 2018
Merged

Master PR for Pull Request Reviews #1491

merged 109 commits into from
Apr 16, 2018

Conversation

grokys
Copy link
Contributor

@grokys grokys commented Feb 15, 2018

This is the master PR for the Pull Request Reviews feature (spiked out over at #1415).

As GitHub won't let us create empty PRs.
grokys and others added 22 commits March 16, 2018 10:54
There was code left over from the now punted "conversation" view. Remove this code because by the time we get back to it, it will be out of date anyway.
And removed missing files.
…iews-code

Removed unused InlineReviews code.
Ported from #1415. Moves the PR details changed files tree into its own view so that it can be shared by the PR reviews view.
Enable navigation from diff view to editor
And associated factory/keychain classes.
This is integrated a bit hackily into `ModelService`; `ModelService` doesn't really mesh well with GraphQL but without a lot of refactoring this was the best way to get things up and running.
As it's ignored by default.
The cursor was not being used for the first page, or ever in fact because the capitalization was wrong.
...in UnitTests. Akavache uses Newtonsoft.Json 6.0.8 while we use 10.0.3. The earlier version needs to be redirected to the later version for tests to work.
This is integrated a bit hackily into `ModelService`; `ModelService` doesn't really mesh well with GraphQL but without a lot of refactoring this was the best way to get things up and running.
Ported from #1415. Moves the PR details changed files tree into its own view so that it can be shared by the PR reviews view.
Enable navigation from diff view to editor
This is integrated a bit hackily into `ModelService`; `ModelService` doesn't really mesh well with GraphQL but without a lot of refactoring this was the best way to get things up and running.
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Utilities, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a duplicate Microsoft.VisualStudio.Utilities reference.

@jcansdale
Copy link
Collaborator

Should I be able to click on the 💬 on the reviewers section? I thought that was one of the PRs that got merged. 😕 I don't seem to be able to in this version.

jcansdale
jcansdale previously approved these changes Apr 13, 2018
Copy link
Collaborator

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't scrutinized every line, but I've been dogfooding it quite a bit and it has been working well!

@jcansdale
Copy link
Collaborator

Should I be able to click on the 💬 on the reviewers section? I thought that was one of the PRs that got merged. 😕 I don't seem to be able to in this version.

No, I misremembered. There was one about making the avatar clickable not the 💬 on the reviewers section.

@drguthals
Copy link
Contributor

This might just be because I re-sized my VM and then re-sized the experimental version of VS, but I just notice that now things are being cut off on the left side within our pane, but I can scroll over to be able to see everything:
screen shot 2018-04-13 at 7 41 49 am

@drguthals
Copy link
Contributor

Looks like the horizontal scroll is stuck at the bottom:
screen shot 2018-04-13 at 7 49 27 am

@meaghanlewis
Copy link
Contributor

meaghanlewis commented Apr 13, 2018

This PR LGTM ✨ tested on VS2015 and 2017.

I ran through these test scenarios and did some exploratory testing as well.

@drguthals
Copy link
Contributor

I double clicked on a folder instead of a file and it caused an exception:
screen shot 2018-04-13 at 9 08 11 am

drguthals
drguthals previously approved these changes Apr 13, 2018
Copy link
Contributor

@drguthals drguthals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Left some comments/questions, but they aren't blockers. Reviewed this in experimental version!

public int Id { get; set; }
public string NodeId { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between Id and NodeId?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you noticed later, NodeId is the GraphQL ID which is different from the "database" Id. I didn't add doc comments to these fields because this will all change as we move move stuff to GraphQL, but I probably should have.

public IReadOnlyCollection<IPullRequestFileModel> ChangedFiles { get; set; } = new IPullRequestFileModel[0];
public IReadOnlyCollection<ICommentModel> Comments { get; set; } = new ICommentModel[0];
public IReadOnlyList<IPullRequestFileModel> ChangedFiles { get; set; } = new IPullRequestFileModel[0];
public IReadOnlyList<ICommentModel> Comments { get; set; } = new ICommentModel[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why switch from IReadOnlyColletion to IReadOnlyList?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IReadOnlyCollection doesn't allow indexers (e.g. collection[0]) which is useful in unit tests. There was no reason to use collection over list so I moved over to that.

@@ -69,8 +67,35 @@ public PullRequestDetailViewModelDesigner()
modelsDir.Files.Add(oldBranchModel);
gitHubDir.Directories.Add(modelsDir);

changedFilesTree = new List<IPullRequestChangeNode>();
changedFilesTree.Add(gitHubDir);
Reviews = new[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is just a model of the type of data that would be included in a real PR Review that you model here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is all in sample data. I get it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sample data for the designer.


namespace GitHub.SampleData
{
public class PullRequestReviewFileCommentViewModelDesigner : IPullRequestReviewFileCommentViewModel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why dont' we have sample data here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this class isn't used directly by the designer, it's used by other sample data view models, so they set the sample data. See https://github.com/github/VisualStudio/pull/1491/files/692beca0cb8b2139246cfa8ce4b71e9e88ba037e#diff-b62ccfc33b879b821bb668fd4cdbee75R37 for example.


// HACK: We need to wait here for the diff view to set itself up and move its cursor
// to the first changed line. There must be a better way of doing this.
await Task.Delay(1500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make a new issue to address this later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, probably, we've had this hack in there since inline comments was first introduced.

statusBar.ShowMessage(message + ": " + e.Message);
}

void AddBufferTag(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the buffer tag? Is it the "PR 1491" that is to the right of the file name on the right diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a way of attaching our own data to a text buffer describing what PR/commit/file a diff view represents. It adds an instance of PullRequestTextBufferInfo as a property of the text buffer. That class is documented (though probably not well enough) instead of this method to avoid duplicating documentation. Might be worth documenting both though if it's confusing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth just putting:

It adds an instance of PullRequestTextBufferInfo as a property of the text buffer.

}
catch (Exception)
{
// TODO: Show error.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be added before the merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, I will address this together with the double-click exceptions in a separate PR.

/// <summary>
/// Gets the GraphQL ID for the review.
/// </summary>
string NodeId { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! So Node Id is for GraphQL. Why is that different from the Id of the review though still?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... That's probably quite a long explanation ;) The short answer is that the REST API exposed database IDs whereas GraphQL uses global relay IDs. At the moment we're using both APIs so for certain models we need both IDs in order to interoperate. This will change hopefully very soon as we move more stuff to GraphQL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh got it - that makes sense for sure :) Thanks!

…or-discoverable

Make Navigate to Editor more discoverable
@jcansdale jcansdale dismissed stale reviews from drguthals and themself via c2b105e April 16, 2018 09:12
@grokys grokys merged commit c0dc9cb into master Apr 16, 2018
@grokys grokys deleted the feature/pr-reviews-master branch April 16, 2018 11:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants