コード例 #1
0
        /// <inheritdoc/>
        public async Task <PullRequestDetailModel> EditComment(LocalRepositoryModel localRepository,
                                                               string remoteRepositoryOwner,
                                                               string commentNodeId,
                                                               string body)
        {
            var address = HostAddress.Create(localRepository.CloneUrl.Host);
            var graphql = await graphqlFactory.CreateConnection(address);

            var updatePullRequestReviewCommentInput = new UpdatePullRequestReviewCommentInput
            {
                Body = body,
                PullRequestReviewCommentId = new ID(commentNodeId),
            };

            var editComment = new Mutation().UpdatePullRequestReviewComment(updatePullRequestReviewCommentInput)
                              .Select(x => new
            {
                x.PullRequestReviewComment.Repository.Owner.Login,
                x.PullRequestReviewComment.PullRequest.Number
            });

            var result = await graphql.Run(editComment);

            await usageTracker.IncrementCounter(x => x.NumberOfPRReviewDiffViewInlineCommentPost);

            return(await ReadPullRequestDetail(address, result.Login, localRepository.Name, result.Number));
        }
コード例 #2
0
        /// <inheritdoc/>
        public async Task <PullRequestReviewCommentModel> EditComment(ILocalRepositoryModel localRepository,
                                                                      string remoteRepositoryOwner,
                                                                      IAccount user,
                                                                      string commentNodeId,
                                                                      string body)
        {
            var address = HostAddress.Create(localRepository.CloneUrl.Host);
            var graphql = await graphqlFactory.CreateConnection(address);

            var updatePullRequestReviewCommentInput = new UpdatePullRequestReviewCommentInput
            {
                Body = body,
                PullRequestReviewCommentId = commentNodeId
            };

            var editComment = new Mutation().UpdatePullRequestReviewComment(updatePullRequestReviewCommentInput)
                              .Select(x => new PullRequestReviewCommentModel
            {
                Id                  = x.PullRequestReviewComment.DatabaseId.Value,
                NodeId              = x.PullRequestReviewComment.Id,
                Body                = x.PullRequestReviewComment.Body,
                CommitId            = x.PullRequestReviewComment.Commit.Oid,
                Path                = x.PullRequestReviewComment.Path,
                Position            = x.PullRequestReviewComment.Position,
                CreatedAt           = x.PullRequestReviewComment.CreatedAt.Value,
                DiffHunk            = x.PullRequestReviewComment.DiffHunk,
                OriginalPosition    = x.PullRequestReviewComment.OriginalPosition,
                OriginalCommitId    = x.PullRequestReviewComment.OriginalCommit.Oid,
                PullRequestReviewId = x.PullRequestReviewComment.PullRequestReview.DatabaseId.Value,
                User                = user,
                IsPending           = !x.PullRequestReviewComment.PublishedAt.HasValue,
            });

            var result = await graphql.Run(editComment);

            await usageTracker.IncrementCounter(x => x.NumberOfPRReviewDiffViewInlineCommentPost);

            return(result);
        }