Skip to content

Commit dbf780d

Browse files
author
Ajit Kumar
committed
fix(plugin): update getUserComment function to use plugin ID for fetching user comments
1 parent 85cd496 commit dbf780d

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

client/components/pluginStatus.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { capitalize, getLoggedInUser, hideLoading, showLoading } from 'lib/helpers';
2+
import prompt from './dialogs/prompt';
23
import select from './dialogs/select';
34

45
/**

client/pages/plugin/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ function CommentsContainerAndForm({ plugin, listRef, user, id, userComment }) {
437437
userComment = await fetch(`/api/comment/${commentId}`).then((userRes) => userRes.json());
438438
$comment = tag.get(`#comment_${commentId}`);
439439
} else {
440-
userComment = await getUserComment(commentId);
440+
userComment = await getUserComment(id);
441441
}
442442

443443
if (!userComment?.comment) {
@@ -577,8 +577,13 @@ async function flagComment(id, flagRef) {
577577
}
578578
}
579579

580-
async function getUserComment(id) {
581-
const res = await fetch(`/api/user/comment/${id}`).then((commentRes) => commentRes.json());
580+
/**
581+
* Gets the current user's comment for a specific plugin.
582+
* @param {string} pluginId Plugin ID
583+
* @returns {Promise<Object>} The user's comment for the specified plugin.
584+
*/
585+
async function getUserComment(pluginId) {
586+
const res = await fetch(`/api/user/comment/${pluginId}`).then((commentRes) => commentRes.json());
582587
return res;
583588
}
584589

0 commit comments

Comments
 (0)