8000 Pull Request conversation view by grokys · Pull Request #2017 · github/VisualStudio · GitHub
[go: up one dir, main page]

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

Pull Request conversation view #2017

Merged
merged 73 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
38cae06
Show document pane for PR conversation.
grokys Oct 26, 2018
50b04ac
Display PR details in document pane.
grokys Oct 26, 2018
cfb1dd3
Initial implementation of PR conversation view.
grokys Oct 26, 2018
02bc4ee
Display sample data in PR conversation page.
grokys Oct 30, 2018
102e337
Load PR timeline from GraphQL.
grokys Oct 30, 2018
424439d
Show commit in TE when OID clicked.
grokys Oct 31, 2018
f976412
Display PR title as pane caption.
grokys Nov 1, 2018
abeb1b8
Display an "Add comment" box at the bottom of a PR.
grokys Nov 1, 2018
b724525
Change close issue caption when comment has body.
grokys Nov 1, 2018
d296739
Implement posting PR comments.
grokys Nov 5, 2018
0b91c87
Disable comment view while submitting.
grokys Nov 5, 2018
1200c4c
Jiggled the comment thread hierachy a little.
grokys Nov 5, 2018
057c4e4
Merge branch 'master' into feature/pr-conversation
grokys Nov 5, 2018
fe66df5
Fix up comment view models after merge.
grokys Nov 5, 2018
a8d4da6
Correctly add new comments.
grokys Nov 5, 2018
d246ad2
Make PR conversation tool windows multi-instance.
grokys Nov 5, 2018
6165f30
Fix UI for closed PRs.
grokys Nov 5, 2018
996aac3
Display commit count.
grokys Nov 5, 2018
6da33e6
Implement closing/reopening a PR.
grokys Nov 8, 2018
c3f9778
Merge branch 'master' into feature/pr-conversation
grokys Nov 9, 2018
1308c0e
Implemented edit/delete of comments.
grokys Nov 14, 2018
6e88e35
Append "commented" after author name
donokuda Nov 16, 2018
8697cb7
Tweak header spacing
donokuda Nov 16, 2018
624b5be
Make it boxy
donokuda Nov 16, 2018
d7d5969
Space it out a bit
donokuda Nov 16, 2018
d12b441
More indenting and layout madness
donokuda Nov 16, 2018
a03c85f
Lighten up the commit octicon
donokuda Nov 16, 2018
aeb7c45
Indent comment body
donokuda Nov 16, 2018
b508e6a
Nudge things around
donokuda Nov 19, 2018
39d0b5f
Standardizing all the spacing
donokuda Nov 19, 2018
b317753
Adjust top margin
donokuda Nov 19, 2018
7ebcfb9
Adjust vertical margins for reply prompt box
donokuda Nov 19, 2018
815ee14
nudge left margin
donokuda Nov 19, 2018
7535c64
Make things better for dark theme
donokuda Nov 20, 2018
1d57ce8
Update separator colors
donokuda Nov 20, 2018
8340942
Merge pull request #2070 from github/donokuda/polish-conversation-view
grokys Nov 22, 2018
7b6a032
Finish off display of commit list w/caption.
grokys Nov 22, 2018
5308404
Theming
donokuda Dec 11, 2018
01676fe
Merge branch 'master' into feature/pr-conversation
grokys Jan 17, 2019
ed0b3a4
Start styling the top comment
donokuda Jan 25, 2019
448ccac
Octicon in a circle yaaaaaa
donokuda Jan 25, 2019
3ca7340
Tweak layout for commit list
donokuda Jan 25, 2019
2ae522c
Decrease the size of the avatar
donokuda Jan 25, 2019
4edf726
Adjust padding
donokuda Jan 26, 2019
6ac2d95
lol at least i tried
donokuda Jan 26, 2019
8f327c2
Octicon timeline theming
donokuda Feb 5, 2019
dc8a865
Let's not be too bold, now
donokuda Feb 5, 2019
5be7e2f
Merge branch 'master' into feature/pr-conversation
grokys Feb 5, 2019
72fb28b
Merge branch 'feature/pr-conversation' into donokuda/pr-polish
grokys Feb 5, 2019
e307b36
Fake it
donokuda Feb 5, 2019
d3caa17
Remove the description section
donokuda Feb 5, 2019
abb4661
Refactored comment views.
grokys Feb 6, 2019
a28d75a
Move around conversation button
donokuda Feb 6, 2019
b1b49a3
Record # of PR conversation views opened.
grokys Feb 7, 2019
e10d6fb
Always leave a note
donokuda Feb 7, 2019
84dd7ff Hook up "View conversation" in PR details pane.
grokys Feb 8, 2019
08bfdc9
Merge branch 'donokuda/pr-pane' into feature/pr-conversation
grokys Feb 8, 2019
d8cf315
Limit to 100 repos per org (fix bad merge)
jcansdale Feb 12, 2019
d05a0ce
Stub out comment count and view on github links
donokuda Feb 13, 2019
8e42868
Add comment octicon and leave some notes around
donokuda Feb 13, 2019
4bdfa13
Add back in the description section
donokuda Feb 13, 2019
c8579c8
Bump spacing
donokuda Feb 13, 2019
5958982
Collapse sections
donokuda Feb 13, 2019
5702cb3
Hook up "View on GitHub" link
jcansdale Feb 19, 2019
e504484
Show number of comments on OpenConversation button
jcansdale Feb 19, 2019
ae6935a
Don't collapse Reviewers or Checks sections
jcansdale Feb 19, 2019
17f3f93
Set the pull request WebUrl and OpenOnGitHub
jcansdale Feb 19, 2019
3f43625
Allow pull request title to wrap
jcansdale Feb 19, 2019
abce76d
Merge pull request #2229 from github/donokuda/moving-some-cheese
jcansdale Feb 20, 2019
a8df4e6
Merge branch 'master' into feature/pr-conversation
jcansdale Feb 20, 2019
fd9eab5
Disabling automatic focus
StanleyGoldman Feb 20, 2019
f144895
Removing left over event handler
StanleyGoldman Feb 20, 2019
89f33ac
Shouldn't need the nuget package for octokit.graphql anymore
StanleyGoldman Feb 21, 2019
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
Prev Previous commit
Next Next commit
Display an "Add comment" box at the bottom of a PR.
  • Loading branch information
grokys committed Nov 1, 2018
commit abeb1b8f125e6f46bd03cc04481c35a70aae543b
2 changes: 2 additions & 0 deletions src/GitHub.App/SampleData/CommentViewModelDesigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public CommentViewModelDesigner()
public CommentEditState EditState { get; set; }
public bool IsReadOnly { get; set; }
public bool IsSubmitting { get; set; }
public bool CanCancel { get; } = true;
public bool CanDelete { get; } = true;
public string CommitCaption { get; set; } = "Comment";
public ICommentThreadViewModel Thread { get; }
public DateTimeOffset CreatedAt => DateTime.Now.Subtract(TimeSpan.FromDays(3));
public IActorViewModel Author { get; set; }
Expand Down
19 changes: 19 additions & 0 deletions src/GitHub.App/ViewModels/CommentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public class CommentViewModel : ReactiveObject, ICommentViewModel
{
static readonly ILogger log = LogManager.ForContext<CommentViewModel>();
readonly ICommentService commentService;
readonly ObservableAsPropertyHelper<bool> canCancel;
readonly ObservableAsPropertyHelper<bool> canDelete;
ObservableAsPropertyHelper<string> commitCaption;
string id;
IActorViewModel author;
IActorViewModel currentUser;
Expand Down Expand Up @@ -74,6 +76,9 @@ public CommentViewModel(ICommentService commentService)
(ro, body) => !ro && !string.IsNullOrWhiteSpace(body)));
AddErrorHandler(CommitEdit);

canCancel = this.WhenAnyValue(x => x.Id)
.Select(id => id != null)
.ToProperty(this, x => x.CanCancel);
CancelEdit = ReactiveCommand.Create(DoCancelEdit, CommitEdit.IsExecuting.Select(x => !x));
AddErrorHandler(CancelEdit);

Expand Down Expand Up @@ -144,6 +149,9 @@ public bool IsSubmitting
protected set => this.RaiseAndSetIfChanged(ref isSubmitting, value);
}

/// <inheritdoc/>
public bool CanCancel => canCancel.Value;

/// <inheritdoc/>
public bool CanDelete => canDelete.Value;

Expand All @@ -154,6 +162,9 @@ public DateTimeOffset CreatedAt
private set => this.RaiseAndSetIfChanged(ref createdAt, value);
}

/// <inheritdoc/>
public string CommitCaption => commitCaption.Value;

/// <inheritdoc/>
public ICommentThreadViewModel Thread
{
Expand Down Expand Up @@ -200,6 +211,8 @@ public Task InitializeAsync(
CreatedAt = comment?.CreatedAt ?? DateTimeOffset.MinValue;
WebUrl = comment?.Url != null ? new Uri(comment.Url) : null;

commitCaption = GetCommitCaptionObservable().ToProperty(this, x => x.CommitCaption);

return Task.CompletedTask;
}

Expand All @@ -208,6 +221,12 @@ protected void AddErrorHandler(ReactiveCommand command)
command.ThrownExceptions.Subscribe(x => ErrorMessage = x.Message);
}

protected virtual IObservable<string> GetCommitCaptionObservable()
{
return this.WhenAnyValue(x => x.Id)
.Select(x => x == null ? Resources.Comment : Resources.UpdateComment);
}

async Task DoDelete()
{
if (commentService.ConfirmCommentDelete())
Expand Down
45 changes: 45 additions & 0 deletions src/GitHub.App/ViewModels/Documents/IIssueishCommentViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Reactive;
using System.Threading.Tasks;
using GitHub.Models;
using ReactiveUI;

namespace GitHub.ViewModels.Documents
{
/// <summary>
/// View model for comments on an issue or pull request.
/// </summary>
public interface IIssueishCommentViewModel : ICommentViewModel
{
/// <summary>
/// Gets a value indicating whether the comment will show a
/// a button for <see cref="CloseIssueish"/>.
/// </summary>
bool CanCloseIssueish { get; }

/// <summary>
/// Gets a a caption for the <see cref="CloseIssueish"/> command.
/// </summary>
string CloseIssueishCaption { get; }

/// <summary>
/// Gets a command which when executed will close the issue or pull request.
/// </summary>
ReactiveCommand<Unit, Unit> CloseIssueish { get; }

/// <summary>
/// Initializes the view model with data.
/// </summary>
/// <param name="thread">The thread that the comment is a part of.</param>
/// <param name="currentUser">The current user.</param>
/// <param name="comment">The comment model. May be null.</param>
/// <param name="closeCaption">
/// The caption for the <see cref="CloseIssueish"/> command, or null if the user cannot
/// close the issue/pr from this comment.
/// </param>
Task InitializeAsync(
ICommentThreadViewModel thread,
ActorModel currentUser,
CommentModel comment,
string closeCaption);
}
}
8000

This file was deleted.

55 changes: 55 additions & 0 deletions src/GitHub.App/ViewModels/Documents/IssueishCommentViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.ComponentModel.Composition;
using System.Reactive;
using System.Threading.Tasks;
using GitHub.Models;
using GitHub.Services;
using ReactiveUI;

namespace GitHub.ViewModels.Documents
{
/// <summary>
/// View model for comments on an issue or pull request.
/// </summary>
[Export(typeof(IIssueishCommentViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class IssueishCommentViewModel : CommentViewModel, IIssueishCommentViewModel
{
/// <summary>
/// Initializes a new instance of the <see cref="CommentViewModel"/> class.
/// </summary>
/// <param name="commentService">The comment service.</param>
[ImportingConstructor]
public IssueishCommentViewModel(ICommentService commentService)
: base(commentService)
{
}

/// <inheritdoc/>
public bool CanCloseIssueish { get; private set; }

/// <inheritdoc/>
public string CloseIssueishCaption { get; private set; }

/// <inheritdoc/>
public ReactiveCommand<Unit, Unit> CloseIssueish { get; }

/// <inheritdoc/>
public async Task InitializeAsync(
ICommentThreadViewModel thread,
ActorModel currentUser,
CommentModel comment,
string closeCaption)
{
await base.InitializeAsync(
thread,
currentUser,
comment,
comment == null ? CommentEditState.Editing : CommentEditState.None)
.ConfigureAwait(true);

CanCloseIssueish = closeCaption != null;
CloseIssueishCaption = closeCaption;
}
}
}
12 changes: 10 additions & 2 deletions src/GitHub.App/ViewModels/Documents/PullRequestPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public async Task InitializeAsync(
break;
case CommentModel comment:
{
var vm = factory.CreateViewModel<ICommentViewModel>();
await vm.InitializeAsync(this, currentUser, comment, CommentEditState.None).ConfigureAwait(true);
var vm = factory.CreateViewModel<IIssueishCommentViewModel>();
await vm.InitializeAsync(this, currentUser, comment, null).ConfigureAwait(true);
timeline.Add(vm);
}
break;
Expand All @@ -102,6 +102,14 @@ public async Task InitializeAsync(
timeline.Add(new CommitSummariesViewModel(commits));
}

var placeholder = factory.CreateViewModel<IIssueishCommentViewModel>();
await placeholder.InitializeAsync(
this,
currentUser,
null,
Resources.ClosePullRequest).ConfigureAwait(true);
timeline.Add(placeholder);

Timeline = timeline;
}

Expand Down
25 changes: 12 additions & 13 deletions src/GitHub.App/ViewModels/PullRequestReviewCommentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace GitHub.ViewModels
public class PullRequestReviewCommentViewModel : CommentViewModel, IPullRequestReviewCommentViewModel
{
readonly ObservableAsPropertyHelper<bool> canStartReview;
readonly ObservableAsPropertyHelper<string> commitCaption;
IPullRequestSession session;
bool isPending;

Expand All @@ -31,19 +30,12 @@ public class PullRequestReviewCommentViewModel : CommentViewModel, IPullRequestR
public PullRequestReviewCommentViewModel(ICommentService commentService)
: base(commentService)
{
var pendingAndIsNew = this.WhenAnyValue(
canStartReview = this.WhenAnyValue(
x => x.IsPending,
x => x.Id,
(isPending, id) => (isPending, isNewComment: id == null));

canStartReview = pendingAndIsNew
.Select(arg => !arg.isPending && arg.isNewComment)
(isPending, id) => !isPending && id == null)
.ToProperty(this, x => x.CanStartReview);

commitCaption = pendingAndIsNew
.Select(arg => !arg.isNewComment ? Resources.UpdateComment : arg.isPending ? Resources.AddReviewComment : Resources.AddSingleComment)
.ToProperty(this, x => x.CommitCaption);

StartReview = ReactiveCommand.CreateFromTask(DoStartReview, CommitEdit.CanExecute);
AddErrorHandler(StartReview);
}
Expand Down Expand Up @@ -82,9 +74,6 @@ await InitializeAsync(
/// <inheritdoc/>
public bool CanStartReview => canStartReview.Value;

/// <inheritdoc/>
public string CommitCaption => commitCaption.Value;

/// <inheritdoc/>
public bool IsPending
{
Expand All @@ -95,6 +84,16 @@ public bool IsPending
/// <inheritdoc/>
public ReactiveCommand<Unit, Unit> StartReview { get; }

protected override IObservable<string> GetCommitCaptionObservable()
{
return this.WhenAnyValue(
x => x.IsPending,
x => x.Id,
(pending, id) => id != null ?
Resources.UpdateComment :
pending ? Resources.AddReviewComment : Resources.AddSingleComment);
}

async Task DoStartReview()
{
IsSubmitting = true;
Expand Down
Loading
0