Skip to content

Commit

Permalink
Providing fields argument to Drive.Comments.create and Drive.Replies.…
Browse files Browse the repository at this point in the history
…create
  • Loading branch information
marekdedic committed Feb 5, 2025
1 parent 6ce11f1 commit fb7ba9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/backend/move/copyFileComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ export function copyFileComments_(
}
const replies = comment.replies;
comment.replies = [];
const commentId = driveService.Comments.create(comment, destinationID).id;
const commentId = driveService.Comments.create(comment, destinationID, {
id: true,
}).id;
for (const reply of replies) {
if (!reply.author.me) {
reply.content = `*${reply.author.displayName}:*\n${reply.content}`;
}
driveService.Replies.create(reply, destinationID, commentId);
driveService.Replies.create(reply, destinationID, commentId, {
fields: "id",
});
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/backend/utils/SafeDriveService/SafeCommentsCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export const SafeCommentsCollection_ = {
fileId: string,
fields: F,
): DeepPick<SafeComment, F> => {
const ret = Drive.Comments.create(resource, fileId);
const ret = Drive.Comments.create(resource, fileId, {
fields: stringifyFields_(fields),
});
if (!commentIsSafe_(ret, fields)) {
throw new Error("Comments.create: Comment is not safe.");
}
Expand Down

0 comments on commit fb7ba9d

Please sign in to comment.