░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/canvas/ui/features/gradebook/react/default_gradebook/apis
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: SubmissionCommentApi.ts
/* * Copyright (C) 2017 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import axios from '@canvas/axios' import timezone from '@canvas/timezone' import type {SubmissionComment, SubmissionCommentData} from '../../../../../api.d' import type {SerializedComment} from '../gradebook.d' function deserializeComment(comment: SubmissionComment): SerializedComment { const baseComment = { id: comment.id, createdAt: timezone.parse(comment.created_at), comment: comment.comment, editedAt: comment.edited_at && timezone.parse(comment.edited_at), } if (!comment.author) { return baseComment } return { ...baseComment, authorId: comment.author.id, author: comment.author.display_name, authorAvatarUrl: comment.author.avatar_image_url, authorUrl: comment.author.html_url, } } function deserializeComments(comments: SubmissionComment[]) { return comments.map(deserializeComment) } function getSubmissionComments(courseId: string, assignmentId: string, studentId: string) { const commentOptions = {params: {include: 'submission_comments'}} const url = `/api/v1/courses/${courseId}/assignments/${assignmentId}/submissions/${studentId}` return axios .get(url, commentOptions) .then(response => deserializeComments(response.data.submission_comments)) } function createSubmissionComment( courseId: string, assignmentId: string, studentId: string, commentData: SubmissionCommentData ) { const url = `/api/v1/courses/${courseId}/assignments/${assignmentId}/submissions/${studentId}` const data = {comment: commentData} return axios .put(url, data) .then(response => deserializeComments(response.data.submission_comments)) } function deleteSubmissionComment(commentId: string) { const url = `/submission_comments/${commentId}` return axios.delete(url) } function updateSubmissionComment(commentId: string, comment: string) { const url = `/submission_comments/${commentId}` const data = {id: commentId, submission_comment: {comment}} return axios .put(url, data) .then(response => ({data: deserializeComment(response.data.submission_comment)})) } export default { createSubmissionComment, deleteSubmissionComment, getSubmissionComments, updateSubmissionComment, }
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 GradebookApi.ts
TS
3.3 KB
2023-09-24 03:36
EDIT
📄 GradebookSettingsModalApi.ts
TS
3.2 KB
2023-09-24 03:36
EDIT
📄 SubmissionCommentApi.ts
TS
2.8 KB
2023-09-24 03:36
EDIT