comments : do not add duplicate comments

This commit is contained in:
isUnknown 2025-02-11 18:45:23 +01:00
parent db7b6171f7
commit d022a9094b
2 changed files with 7 additions and 0 deletions

View file

@ -19,6 +19,12 @@ return [
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
foreach ($comments as $existingComment) {
if ($existingComment['author']['email'] === $user->email() && $existingComment['text'] === $data->text) {
return json_encode(null);
}
}
$commentData = [
'location' => [
'page' => $page,

View file

@ -222,6 +222,7 @@ async function addComment(newComment) {
const newFile = await api.addComment(newComment);
resetDraftComment();
isAddOpen.value = false;
if (!newFile) return;
dialog.updateFile(newFile);
if (activeTracks.value) {
activeTracks.value = activeTracks.value.map((track) => {