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

Commit bc7be90

Browse files
committed
Merge branch 'master' into devops/build-on-2019
2 parents 60d1215 + 5037fe1 commit bc7be90

File tree

143 files changed

+16285
-598
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+16285
-598
lines changed

Directory.Build.Props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<Product>GitHub Extension for Visual Studio</Product>
4-
<Version>2.8.0.0</Version>
4+
<Version>2.9.0.0</Version>
55
<Copyright>Copyright © GitHub, Inc. 2014-2018</Copyright>
66
<LangVersion>7.3</LangVersion>
77
</PropertyGroup>

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
os: Visual Studio 2017
2-
version: '2.8.0.{build}'
2+
version: '2.9.0.{build}'
33
skip_tags: true
44

55
install:

docs/using/publishing-an-existing-project-to-github.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
5. Click the **Publish to GitHub** button.
1111
![Location of the Publish to GitHub button in the Team Explorer pane](images/publish-to-github.png)
1212
6. Enter a name and description for the repository on GitHub.
13-
7. Check the **Private Repository** box if you want to upload the repository as a private repository on GitHub. You must have a [Developer, Team or Business account](https://github.com/pricing) to create private repositories.
13+
7. Check the **Private Repository** box if you want to upload the repository as a private repository on GitHub.
1414
8. Click the **Publish** button.

src/GitHub.App/Models/PullRequestModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ public string Title
110110
}
111111
}
112112

113-
PullRequestStateEnum status;
114-
public PullRequestStateEnum State
113+
PullRequestState status;
114+
public PullRequestState State
115115
{
116116
get { return status; }
117117
set
@@ -126,8 +126,8 @@ public PullRequestStateEnum State
126126
}
127127

128128
// TODO: Remove these property once maintainer workflow has been merged to master.
129-
public bool IsOpen => State == PullRequestStateEnum.Open;
130-
public bool Merged => State == PullRequestStateEnum.Merged;
129+
public bool IsOpen => State == PullRequestState.Open;
130+
public bool Merged => State == PullRequestState.Merged;
131131

132132
int commentCount;
133133
public int CommentCount

src/GitHub.App/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.SampleData")]
44
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.SampleData.Dialog.Clone")]
5+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.SampleData.Documents")]
56
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels")]
67
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.Dialog")]
78
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.Dialog.Clone")]
9+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.Documents")]
810
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.GitHubPane")]

src/GitHub.App/SampleData/CommentViewModelDesigner.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Diagnostics.CodeAnalysis;
33
using System.Reactive;
4+
using System.Threading.Tasks;
5+
using GitHub.Models;
46
using GitHub.ViewModels;
57
using ReactiveUI;
68

@@ -22,7 +24,9 @@ public CommentViewModelDesigner()
2224
public CommentEditState EditState { get; set; }
2325
public bool IsReadOnly { get; set; }
2426
public bool IsSubmitting { get; set; }
27+
public bool CanCancel { get; } = true;
2528
public bool CanDelete { get; } = true;
29+
public string CommitCaption { get; set; } = "Comment";
2630
public ICommentThreadViewModel Thread { get; }
2731
public DateTimeOffset CreatedAt => DateTime.Now.Subtract(TimeSpan.FromDays(3));
2832
public IActorViewModel Author { get; set; }
@@ -31,7 +35,12 @@ public CommentViewModelDesigner()
3135
public ReactiveCommand<Unit, Unit> BeginEdit { get; }
3236
public ReactiveCommand<Unit, Unit> CancelEdit { get; }
3337
public ReactiveCommand<Unit, Unit> CommitEdit { get; }
34-
public ReactiveCommand<Unit, Unit> OpenOnGitHub { get; }
38+
public ReactiveCommand<Unit, Unit> OpenOnGitHub { get; } = ReactiveCommand.Create(() => { });
3539
public ReactiveCommand<Unit, Unit> Delete { get; }
40+
41+
public Task InitializeAsync(ICommentThreadViewModel thread, ActorModel currentUser, CommentModel comment, CommentEditState state)
42+
{
43+
return Task.CompletedTask;
44+
}
3645
}
3746
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using GitHub.Models;
4+
using GitHub.ViewModels;
5+
using GitHub.ViewModels.Documents;
6+
using ReactiveUI;
7+
8+
namespace GitHub.SampleData.Documents
9+
{
10+
public class IssueishCommentThreadViewModelDesigner : ViewModelBase, IIssueishCommentThreadViewModel
11+
{
12+
public IActorViewModel CurrentUser { get; } = new ActorViewModelDesigner("grokys");
13+
public Task InitializeAsync(ActorModel currentUser, IssueishDetailModel model, bool addPlaceholder) => Task.CompletedTask;
14+
public Task DeleteComment(ICommentViewModel comment) => Task.CompletedTask;
15+
public Task EditComment(ICommentViewModel comment) => Task.CompletedTask;
16+
public Task PostComment(ICommentViewModel comment) => Task.CompletedTask;
17+
public Task CloseOrReopen(ICommentViewModel comment) => Task.CompletedTask;
18+
}
19+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Reactive;
4+
using System.Threading.Tasks;
5+
using GitHub.Models;
6+
using GitHub.ViewModels;
7+
using GitHub.ViewModels.Documents;
8+
using ReactiveUI;
9+
10+
namespace GitHub.SampleData.Documents
11+
{
12+
public class PullRequestPageViewModelDesigner : ViewModelBase, IPullRequestPageViewModel
13+
{
14+
public PullRequestPageViewModelDesigner()
15+
{
16+
Body = @"Save drafts of inline comments, PR reviews and PRs.
17+
18+
> Note: This feature required a refactoring of the comment view models because they now need async initialization and to be available from GitHub.App. This part of the PR has been submitted separately as #1993 to ease review. The two PRs can alternatively be reviewed as one if that's more convenient.
19+
20+
As described in #1905, it is easy to lose a comment that you're working on if you close the diff view accidentally. This PR saves drafts of comments as they are being written to an SQLite database.
21+
22+
In addition to saving drafts of inline comments, it also saves comments to PR reviews and PRs themselves.
23+
24+
The comments are written to an SQLite database directly instead of going through Akavache because in the case of inline reviews, there can be many drafts in progress on a separate file. When a diff is opened we need to look for any comments present on that file and show the most recent. That use-case didn't fit well with Akavache (being a pure key/value store).
25+
26+
## Testing
27+
28+
### Inline Comments
29+
30+
- Open a PR
31+
- Open the diff of a file
32+
- Start adding a comment
33+
- Close the comment by closing the peek view, or the document tab
34+
- Reopen the diff
35+
- You should see the comment displayed in edit mode with the draft of the comment you were previously writing
36+
37+
### PR reviews
38+
39+
- Open a PR
40+
- Click ""Add your review""
41+
- Start adding a review
42+
- Click the ""Back"" button and navigate to a different PR
43+
- Click the ""Back"" button and navigate to the original PR
44+
- Click ""Add your review""
45+
- You should see the the draft of the review you were previously writing
46+
47+
### PRs
48+
49+
-Click ""Create new"" at the top of the PR list
50+
- Start adding a PR title/ description
51+
- Close VS
52+
- Restart VS and click ""Create new"" again
53+
- You should see the the draft of the PR you were previously writing
54+
55+
Depends on #1993
56+
Fixes #1905";
57+
Timeline = new IViewModel[]
58+
{
59+
new CommitListViewModel(
60+
new CommitSummaryViewModel(new CommitModel
61+
{
62+
Author = new ActorModel { Login = "grokys" },
63+
AbbreviatedOid = "c7c7d25",
64+
MessageHeadline = "Refactor comment view models."
65+
}),
66+
new CommitSummaryViewModel(new CommitModel
67+
{
68+
Author = new ActorModel { Login = "shana" },
69+
AbbreviatedOid = "04e6a90",
70+
MessageHeadline = "Refactor comment view models.",
71+
})),
72+
new CommentViewModelDesigner
73+
{
74+
Author = new ActorViewModelDesigner("meaghanlewis"),
75+
Body = @"This is looking great! Really enjoying using this feature so far.
76+
77+
When leaving an inline comment, the comment posts successfully and then a new comment is drafted with the same text.",
78+
},
79+
new CommentViewModelDesigner
80+
{
81+
Author = new ActorViewModelDesigner("grokys"),
82+
Body = @"Oops, sorry about that @meaghanlewis - I was sure I tested those things, but must have got messed up again at some point. Should be fixed now.",
83+
},
84+
};
85+
}
86+
87+
public string Id { get; set; }
88+
public PullRequestState State { get; set; } = PullRequestState.Open;
89+
public IReadOnlyList<IViewModel> Timeline { get; }
90+
public string SourceBranchDisplayName { get; set; } = "feature/save-drafts";
91+
public string TargetBranchDisplayName { get; set; } = "master";
92+
public IActorViewModel Author { get; set; } = new ActorViewModelDesigner("grokys");
93+
public int CommitCount { get; set; } = 2;
94+
public string Body { get; set; }
95+
public int Number { get; set; } = 1994;
96+
public LocalRepositoryModel LocalRepository { get; }
97+
public RemoteRepositoryModel Repository { get; set; }
98+
public string Title { get; set; } = "Save drafts of comments";
99+
public Uri WebUrl { get; set; }
100+
public ReactiveCommand<Unit, Unit> OpenOnGitHub { get; }
101+
public ReactiveCommand<string, Unit> ShowCommit { get; }
102+
103+
104+
public Task InitializeAsync(RemoteRepositoryModel repository, LocalRepositoryModel localRepository, ActorModel currentUser, PullRequestDetailModel model)
105+
{
106+
throw new NotImplementedException();
107+
}
108+
}
109+
}

src/GitHub.App/SampleData/PullRequestDetailViewModelDesigner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public PullRequestDetailViewModelDesigner()
124124
public ReactiveCommand<Unit, Unit> Pull { get; }
125125
public ReactiveCommand<Unit, Unit> Push { get; }
126126
public ReactiveCommand<Unit, Unit> SyncSubmodules { get; }
127+
public ReactiveCommand<Unit, Unit> OpenConversation { get; }
127128
public ReactiveCommand<Unit, Unit> OpenOnGitHub { get; }
128129
public ReactiveCommand<IPullRequestReviewSummaryViewModel, Unit> ShowReview { get; }
129130
public ReactiveCommand<IPullRequestCheckViewModel, Unit> ShowAnnotations { get; }

src/GitHub.App/SampleData/PullRequestListViewModelDesigner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public PullRequestListViewModelDesigner()
6363
public IReadOnlyList<string> States { get; }
6464
public Uri WebUrl => null;
6565
public ReactiveCommand<Unit, Unit> CreatePullRequest { get; }
66+
public ReactiveCommand<IPullRequestListItemViewModel, Unit> OpenConversation { get; }
6667
public ReactiveCommand<IIssueListItemViewModelBase, Unit> OpenItem { get; }
6768
public ReactiveCommand<IPullRequestListItemViewModel, IPullRequestListItemViewModel> OpenItemInBrowser { get; }
6869

0 commit comments

Comments
 (0)