diff --git a/frontend/src/components/review-list-view/review-comments.js b/frontend/src/components/review-list-view/review-comments.js index 5bf98088e4..34c7b9474a 100644 --- a/frontend/src/components/review-list-view/review-comments.js +++ b/frontend/src/components/review-list-view/review-comments.js @@ -6,6 +6,7 @@ import { seafileAPI } from '../../utils/seafile-api'; import { reviewID, gettext } from '../../utils/constants'; import Loading from '../../components/loading.js'; import reviewComment from '../../models/review-comment.js'; +import { username } from '../../utils/constants.js'; import '../../css/review-comments.css'; @@ -27,7 +28,6 @@ class ReviewComments extends React.Component { showResolvedComment: true, comment: '', }; - this.accountInfo = {}; } listComments = (scroll) => { @@ -68,6 +68,7 @@ class ReviewComments extends React.Component { resolveComment = (event) => { seafileAPI.updateReviewComment(reviewID, event.target.id, 'true').then((res) => { + this.props.getCommentsNumber(); this.listComments(); }); } @@ -172,7 +173,7 @@ class ReviewComments extends React.Component { this.state.commentsList.map((item, index) => { return ( ); }) @@ -202,7 +203,6 @@ const commentItemPropTypes = { item: PropTypes.object.isRequired, deleteComment: PropTypes.func.isRequired, resolveComment: PropTypes.func.isRequired, - accountInfo: PropTypes.object.isRequired, showResolvedComment: PropTypes.bool.isRequired, scrollToQuote: PropTypes.func.isRequired }; @@ -277,7 +277,7 @@ class CommentItem extends React.Component { - { (item.userEmail === this.props.accountInfo.email) && + { (item.userEmail === username) && {gettext('Delete')}} { seafileAPI.listReviewComments(reviewID).then((res) => { let number = res.data.total_count; + let comments = res.data.comments; + let unresolvedComments = 0; + for (let i = 0; i < res.data.total_count; i++) { + if (comments[i].resolved === false) { + unresolvedComments++; + } + } this.setState({ commentsNumber: number, + unresolvedComments: unresolvedComments, }); }); } @@ -379,8 +391,6 @@ class DraftReview extends React.Component { const focusText = document.getNode(focus.key); const anchorInline = document.getClosestInline(anchor.key); const focusInline = document.getClosestInline(focus.key); - const focusBlock = document.getClosestBlock(focus.key); - const anchorBlock = document.getClosestBlock(anchor.key); // COMPAT: If the selection is at the end of a non-void inline node, and // there is a node after it, put it in the node after instead. This // standardizes the behavior, since it's indistinguishable to the user. @@ -571,6 +581,15 @@ class DraftReview extends React.Component { componentWillMount() { this.getCommentsNumber(); this.listReviewers(); + this.getOriginRepoInfo(); + } + + getOriginRepoInfo = () => { + seafileAPI.getRepoInfo(draftOriginRepoID).then((res) => { + this.setState({ + originRepoName: res.data.repo_name + }); + }); } initialDiffViewerContent = () => { @@ -867,11 +886,18 @@ class DraftReview extends React.Component { reviewers={this.state.reviewers} toggleAddReviewerDialog={this.toggleAddReviewerDialog}/> + { this.state.isShowDiff && } + + @@ -970,6 +996,61 @@ class SidePanelAuthor extends React.Component { } } +class SidePanelOrigin extends React.Component { + + constructor(props) { + super(props); + } + + render() { + return ( +
+ + + + + + + + +
{gettext('Library')}{this.props.originRepoName}
{gettext('Position')}{draftOriginFilePath}
+
+ ); + } +} + +const SidePanelOriginPropTypes = { + originRepoName: PropTypes.string.isRequired +}; + +SidePanelOrigin.propTypes = SidePanelOriginPropTypes; + + +class UnresolvedComments extends React.Component { + + constructor(props) { + super(props); + } + + render() { + return ( +
+
{gettext('Comments')}
+
+ {gettext('Unresolved comments:')}{' '}{this.props.number} +
+
+ ); + } +} + +const UnresolvedCommentsPropTypes = { + number: PropTypes.number.isRequired +}; + +UnresolvedComments.propTypes = UnresolvedCommentsPropTypes; + + class SidePanelChanges extends React.Component { constructor(props) {