This is an automated email from the ASF dual-hosted git repository. wangzx pushed a commit to branch gh-pages in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
The following commit(s) were added to refs/heads/gh-pages by this push: new 7b97ba18 fix(editor): fetch latest review comment when a review has no comment. 7b97ba18 is described below commit 7b97ba188c69f629fdfeb9caf0ce9163251acbde Author: plainheart <y...@all-my-life.cn> AuthorDate: Thu Jun 29 22:04:47 2023 +0800 fix(editor): fetch latest review comment when a review has no comment. --- src/editor/Editor.vue | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/editor/Editor.vue b/src/editor/Editor.vue index d499b502..a9640537 100644 --- a/src/editor/Editor.vue +++ b/src/editor/Editor.vue @@ -713,8 +713,39 @@ export default { }, dataType: 'json', success: (reviews) => { - this.prLatestReview = reviews[reviews.length - 1]; - this.isPRReviewLoading = 0; + const prLatestReview = (this.prLatestReview = + reviews[reviews.length - 1]); + if ( + prLatestReview && + prLatestReview.state === 'COMMENTED' && + !prLatestReview.body + ) { + $.ajax({ + url: + prURL + + '/reviews/' + + prLatestReview.id + + '/comments?direction=desc&sort=created&per_page=100', + headers: { + Accept: 'application/json' + }, + dataType: 'json', + success: (comments) => { + const comment = comments[0]; + prLatestReview.body = comment.body; + prLatestReview.submitted_at = comment.created_at; + prLatestReview.html_url = comment.html_url; + }, + error: (xhr, status, err) => { + console.error('failed to fetch PR review comment', err); + }, + complete: () => { + this.isPRReviewLoading = 0; + } + }); + } else { + this.isPRReviewLoading = 0; + } }, error: (xhr, status, err) => { this.isPRReviewLoading = false; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org