comments : do not add duplicate comments
This commit is contained in:
parent
db7b6171f7
commit
d022a9094b
2 changed files with 7 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue