mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 06:11:16 +00:00
Update draft page (#3036)
* draft-update * test * update draft reviewer api * update draft page * add file path
This commit is contained in:
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from 'reactstrap';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import { reviewID, gettext, name } from '../../utils/constants';
|
||||
import { gettext, name, draftRepoID, draftFilePath } from '../../utils/constants';
|
||||
import { processor } from '../../utils/seafile-markdown2html';
|
||||
|
||||
import '../../css/review-comment-dialog.css';
|
||||
@@ -13,6 +13,7 @@ const commentDialogPropTypes = {
|
||||
quote: PropTypes.string,
|
||||
newIndex: PropTypes.number,
|
||||
oldIndex: PropTypes.number,
|
||||
draftID: PropTypes.string,
|
||||
};
|
||||
|
||||
class ReviewCommentDialog extends React.Component {
|
||||
@@ -42,12 +43,12 @@ class ReviewCommentDialog extends React.Component {
|
||||
oldIndex: this.props.oldIndex
|
||||
};
|
||||
let detailJSON = JSON.stringify(detail);
|
||||
seafileAPI.addReviewComment(reviewID, comment, detailJSON).then((response) => {
|
||||
seafileAPI.postComment(draftRepoID, draftFilePath, comment, detailJSON).then((response) => {
|
||||
this.props.onCommentAdded();
|
||||
});
|
||||
}
|
||||
else {
|
||||
seafileAPI.addReviewComment(reviewID, comment).then((response) => {
|
||||
seafileAPI.postComment(draftRepoID, draftFilePath, comment).then((response) => {
|
||||
this.props.onCommentAdded();
|
||||
});
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import { processor } from '../../utils/seafile-markdown2html';
|
||||
import { Button, Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import { reviewID, gettext } from '../../utils/constants';
|
||||
import { gettext, draftFilePath, draftRepoID } from '../../utils/constants';
|
||||
import Loading from '../../components/loading.js';
|
||||
import reviewComment from '../../models/review-comment.js';
|
||||
import { username } from '../../utils/constants.js';
|
||||
@@ -24,14 +24,14 @@ class ReviewComments extends React.Component {
|
||||
this.state = {
|
||||
commentsList: [],
|
||||
inResizing: false,
|
||||
commentFooterHeight: 30,
|
||||
commentFooterHeight: 25,
|
||||
showResolvedComment: true,
|
||||
comment: '',
|
||||
};
|
||||
}
|
||||
|
||||
listComments = (scroll) => {
|
||||
seafileAPI.listReviewComments(reviewID).then((response) => {
|
||||
seafileAPI.listComments(draftRepoID, draftFilePath).then((response) => {
|
||||
response.data.comments.reverse();
|
||||
let commentList = [];
|
||||
response.data.comments.forEach(item => {
|
||||
@@ -56,7 +56,7 @@ class ReviewComments extends React.Component {
|
||||
submitComment = () => {
|
||||
let comment = this.state.comment.trim();
|
||||
if (comment.length > 0) {
|
||||
seafileAPI.addReviewComment(reviewID, comment).then((response) => {
|
||||
seafileAPI.postComment(draftRepoID, draftFilePath, comment).then((response) => {
|
||||
this.listComments(true);
|
||||
this.props.getCommentsNumber();
|
||||
});
|
||||
@@ -67,7 +67,7 @@ class ReviewComments extends React.Component {
|
||||
}
|
||||
|
||||
resolveComment = (event) => {
|
||||
seafileAPI.updateReviewComment(reviewID, event.target.id, 'true').then((res) => {
|
||||
seafileAPI.updateComment(draftRepoID, event.target.id, 'true').then((res) => {
|
||||
this.props.getCommentsNumber();
|
||||
this.listComments();
|
||||
});
|
||||
@@ -80,7 +80,7 @@ class ReviewComments extends React.Component {
|
||||
}
|
||||
|
||||
deleteComment = (event) => {
|
||||
seafileAPI.deleteReviewComment(reviewID, event.target.id).then((res) => {
|
||||
seafileAPI.deleteComment(draftRepoID, event.target.id).then((res) => {
|
||||
this.props.getCommentsNumber();
|
||||
this.listComments();
|
||||
});
|
||||
|
Reference in New Issue
Block a user