1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00

07 change docUuid to fileUuid

This commit is contained in:
Michael An 2025-04-21 17:11:15 +08:00
parent 55677bda41
commit 8871eb410b
3 changed files with 26 additions and 26 deletions

View File

@ -9,7 +9,7 @@ import ReplyList from './comment-widget/reply-list';
import '../../css/comments-list.css';
const { username, repoID, filePath, docUuid } = window.app.pageOptions;
const { username, repoID, filePath, fileUuid } = window.app.pageOptions;
const CommentPanelPropTypes = {
toggleCommentPanel: PropTypes.func.isRequired,
@ -33,7 +33,7 @@ class CommentPanel extends React.Component {
}
listComments = () => {
seafileAPI.listComments(repoID, docUuid).then((res) => {
seafileAPI.listComments(repoID, fileUuid).then((res) => {
this.setState({
commentsList: res.data.comments,
isLoading: false,
@ -66,7 +66,7 @@ class CommentPanel extends React.Component {
};
addComment = (comment) => {
seafileAPI.postComment(repoID, docUuid, comment).then(() => {
seafileAPI.postComment(repoID, fileUuid, comment).then(() => {
this.listComments();
}).catch(err => {
toaster.danger(Utils.getErrorMsg(err));
@ -80,7 +80,7 @@ class CommentPanel extends React.Component {
type: 'reply',
updated_at: dayjs().format('YYYY-MM-DD HH:mm:ss')
};
seafileAPI.insertReply(repoID, docUuid, this.state.currentComment.id, replyData).then(() => {
seafileAPI.insertReply(repoID, fileUuid, this.state.currentComment.id, replyData).then(() => {
this.listComments();
}).catch(err => {
toaster.danger(Utils.getErrorMsg(err));
@ -88,7 +88,7 @@ class CommentPanel extends React.Component {
};
resolveComment = (comment, resolveState = 'true') => {
seafileAPI.updateComment(repoID, docUuid, comment.id, resolveState, null, null).then(() => {
seafileAPI.updateComment(repoID, fileUuid, comment.id, resolveState, null, null).then(() => {
this.listComments();
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
@ -97,7 +97,7 @@ class CommentPanel extends React.Component {
};
deleteComment = (comment) => {
seafileAPI.deleteComment(repoID, docUuid, comment.id).then(() => {
seafileAPI.deleteComment(repoID, fileUuid, comment.id).then(() => {
this.clearCurrentComment();
this.listComments();
}).catch(error => {
@ -107,7 +107,7 @@ class CommentPanel extends React.Component {
};
deleteReply = (commentId, replyId) => {
seafileAPI.deleteReply(repoID, docUuid, commentId, replyId).then(() => {
seafileAPI.deleteReply(repoID, fileUuid, commentId, replyId).then(() => {
this.listComments();
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
@ -122,7 +122,7 @@ class CommentPanel extends React.Component {
type: 'reply',
updated_at: dayjs().format('YYYY-MM-DD HH:mm:ss')
};
seafileAPI.updateReply(repoID, docUuid, commentId, replyId, replyData).then(() => {
seafileAPI.updateReply(repoID, fileUuid, commentId, replyId, replyData).then(() => {
this.listComments();
}).catch(err => {
toaster.danger(Utils.getErrorMsg(err));
@ -130,7 +130,7 @@ class CommentPanel extends React.Component {
};
editComment = (comment, newComment) => {
seafileAPI.updateComment(repoID, docUuid, comment.id, null, null, newComment).then((res) => {
seafileAPI.updateComment(repoID, fileUuid, comment.id, null, null, newComment).then((res) => {
this.listComments();
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);

View File

@ -1277,25 +1277,25 @@ class SeafileAPI {
return this.req.post(url, form);
}
listComments(repoID, docUuid) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/`;
listComments(repoID, fileUuid) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/`;
return this.req.get(url);
}
postComment(repoID, docUuid, comment) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/`;
postComment(repoID, fileUuid, comment) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/`;
let form = new FormData();
form.append('comment', comment);
return this._sendPostRequest(url, form);
}
deleteComment(repoID, docUuid, commentID) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/${commentID}/`;
deleteComment(repoID, fileUuid, commentID) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/${commentID}/`;
return this.req.delete(url);
}
updateComment(repoID, docUuid, commentID, resolved, detail, comment) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/${commentID}/`;
updateComment(repoID, fileUuid, commentID, resolved, detail, comment) {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/${commentID}/`;
let params = {};
if (resolved) {
params.resolved = resolved;
@ -1309,13 +1309,13 @@ class SeafileAPI {
return this.req.put(url, params);
}
listReplies = (repoID, docUuid, commentID) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/${commentID}/replies/`;
listReplies = (repoID, fileUuid, commentID) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/${commentID}/replies/`;
return this.req.get(url);
};
insertReply = (repoID, docUuid, commentID, replyData) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/${commentID}/replies/`;
insertReply = (repoID, fileUuid, commentID, replyData) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/${commentID}/replies/`;
let form = new FormData();
for (let key in replyData) {
form.append(key, replyData[key]);
@ -1323,13 +1323,13 @@ class SeafileAPI {
return this._sendPostRequest(url, form);
};
deleteReply = (repoID, docUuid, commentID, replyId) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/${commentID}/replies/${replyId}/`;
deleteReply = (repoID, fileUuid, commentID, replyId) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/${commentID}/replies/${replyId}/`;
return this.req.delete(url);
};
updateReply = (repoID, docUuid, commentID, replyId, replyData) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${docUuid}/comments/${commentID}/replies/${replyId}/`;
updateReply = (repoID, fileUuid, commentID, replyId, replyData) => {
let url = `${this.server}/api/v2.1/repos/${repoID}/file/${fileUuid}/comments/${commentID}/replies/${replyId}/`;
return this.req.put(url, replyData);
};

View File

@ -28,7 +28,7 @@ window.app.pageOptions = {
latestContributorName: '{{ latest_contributor|email2nickname|escapejs }}',
lastModificationTime: '{{ last_modified }}',
repoID: '{{ repo.id }}',
docUuid: '{{ file_uuid }}',
fileUuid: '{{ file_uuid }}',
repoName: '{{ repo.name|escapejs }}',
repoEncrypted: {% if repo.encrypted %}true{% else %}false{% endif %},
isRepoAdmin: {% if is_repo_admin %}true{% else %}false{% endif %},