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

Conversation

@StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented May 21, 2018

Depends on:

image

  • Added Edit/Delete comment functionality for inline comment views
    • Even though an administrator can edit/delete any comment. For a first pass we only added the functionality to comments owned by the current viewer.


<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right"
Visibility="{Binding CanEditOrDelete, Converter={ui:BooleanToVisibilityConverter}}">
<ui:GitHubActionLink Content="Edit"
Copy link
Collaborator

Choose a reason for hiding this comment

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

image

image

Rather than Edit, should this be Update comment like on .com? 👆

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this references the Edit / Delete links in the screenshot above?

Screenshot of feature

If so, I think it's okay to leave this the way how it is. However, I'm 👍 for having the submit button text be "Update comment" like the dotcom screenshot you've posted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed up.

Copy link
Contributor

@donokuda donokuda left a comment

Choose a reason for hiding this comment

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

Same feedback as @jcansdale. Otherwise looking good.

</Style.Triggers>
</Style>
</StackPanel.Style>
<Button Command="{Binding CommitEdit}">Edit</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Per @jcansdale's comment, can we change this to "Update comment" so it's inline with the interaction on dotcom?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed up.

public ReactiveCommand<ICommentModel> EditComment
{
get { return editComment; }
set
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you followed PostComment and made this setter public - I think that was an oversight, it should be protected. When you fix this, could you fix PostComment too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made them protected

public ReactiveCommand<object> DeleteComment
{
get { return deleteComment; }
set
Copy link
Contributor

Choose a reason for hiding this comment

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

As with this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@StanleyGoldman StanleyGoldman force-pushed the features/inline-comment-edit-and-delete branch from bd0e9a9 to cc12bea Compare May 29, 2018 12:19
@meaghanlewis meaghanlewis added this to the 2.5.3 milestone May 29, 2018
@StanleyGoldman
Copy link
Contributor Author

@meaghanlewis good catch. I fixed that up.

x => x.EditState,
x => x == CommentEditState.None && user.Login.Equals(currentUser.Login));

canDelete.Subscribe(b => CanDelete = b);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use ObservableAsPropertyHelper to make this a bit neater.

@grokys
Copy link
Contributor

grokys commented May 31, 2018

Oops, clicked "approve" before writing my comment ;)

Looks good and works well - just one small suggestion, but I don't think that should hold up an approval.

Copy link
Contributor

@grokys grokys left a comment

Choose a reason for hiding this comment

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

Oops, spoke too soon. This fails to edit a pending comment:

image

To repro:

  1. Add a comment, click start review
  2. Try to edit the comment

This is because you're using the REST API for editing the comment and the REST API doesn't work with pending comments. We'll have to use GraphQL for this.

/// <param name="inReplyTo">The REST ID of the comment to reply to.</param>
/// <param name="inReplyToNodeId">The GraphQL ID of the comment to reply to.</param>
/// <returns></returns>
/// <returns>A comment model.</returns>

Choose a reason for hiding this comment

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

Adding an inline comment

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. this is a test.

@meaghanlewis
Copy link
Contributor

Nice catch @grokys! I'm able to update comments now when a review is pending.

@meaghanlewis
Copy link
Contributor

@StanleyGoldman - on a similar note about pending reviews...i don't seem to be able to delete comments while a review is pending. And then trying to update after clicking delete shows a Not Found error even though I still seem to be able to update the comment successfully.

cant delete pending comment

@grokys grokys mentioned this pull request May 31, 2018
3 tasks
@meaghanlewis
Copy link
Contributor

One more thought about this. On dotcom when I go to delete a comment, I get a confirmation popup from the browser:

confirm delete comment

I'm wondering if it would be possible to add a confirmation in Visual Studio as well?

Copy link
Contributor

@grokys grokys left a comment

Choose a reason for hiding this comment

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

One nit but seems to work fine with pending reviews now!

CommentEditState state;
DateTimeOffset updatedAt;
string undoBody;
private bool canDelete;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Stray private

@StanleyGoldman
Copy link
Contributor Author

@meaghanlewis I opened #1713 to reflect your comments

@grokys grokys dismissed jcansdale’s stale review June 1, 2018 07:05

Changes addressed.

@grokys grokys merged commit 0bf5d88 into master Jun 1, 2018
@grokys grokys deleted the features/inline-comment-edit-and-delete branch June 1, 2018 07:06
grokys added a commit that referenced this pull request Jun 1, 2018
Mainly merging #1701

 Conflicts:
	src/GitHub.Exports.Reactive/Services/IPullRequestSession.cs
	src/GitHub.InlineReviews/SampleData/CommentThreadViewModelDesigner.cs
	src/GitHub.InlineReviews/Services/IPullRequestSessionService.cs
	src/GitHub.InlineReviews/Services/PullRequestSession.cs
	src/GitHub.InlineReviews/Services/PullRequestSessionService.cs
	src/GitHub.InlineReviews/ViewModels/CommentThreadViewModel.cs
	src/GitHub.InlineReviews/ViewModels/CommentViewModel.cs
	src/GitHub.InlineReviews/ViewModels/ICommentThreadViewModel.cs
	test/GitHub.InlineReviews.UnitTests/ViewModels/PullRequestReviewCommentViewModelTests.cs
@meaghanlewis meaghanlewis modified the milestones: 2.5.3, 2.5.4 Jun 13, 2018
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.

6 participants