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

Commit e68dc06

Browse files
Cleaning up code
1 parent 0999f2c commit e68dc06

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/GitHub.InlineReviews/ViewModels/PullRequestReviewCommentViewModel.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ public PullRequestReviewCommentViewModel(
5454
this.session = session;
5555
IsPending = isPending;
5656

57-
var pendingReviewAndIdObservable = Observable.Zip(session.WhenAnyValue(x => x.HasPendingReview, x => !x), this.WhenAnyValue(model => model.Id, i => i == 0));
57+
var pendingReviewAndIdObservable = Observable.CombineLatest(session.WhenAnyValue(x => x.HasPendingReview, x => !x),
58+
this.WhenAnyValue(model => model.Id, i => i == 0),
59+
(hasPendingReview, isNewComment) => new { hasPendingReview, isNewComment });
5860

5961
canStartReview = pendingReviewAndIdObservable
60-
.Select(list => list.All(b => b))
62+
.Select(arg => arg.hasPendingReview && arg.isNewComment)
6163
.ToProperty(this, x => x.CanStartReview);
6264

6365
commitCaption = pendingReviewAndIdObservable
64-
.Select(list => !list[1] ? Resources.EditComment : list[0] ? Resources.AddSingleComment : Resources.AddReviewComment)
66+
.Select(arg => !arg.isNewComment ? Resources.EditComment : arg.hasPendingReview ? Resources.AddSingleComment : Resources.AddReviewComment)
6567
.ToProperty(this, x => x.CommitCaption);
6668

6769
StartReview = ReactiveCommand.CreateAsyncTask(

0 commit comments

Comments
 (0)