comments working

This commit is contained in:
isUnknown 2025-01-15 14:18:48 +01:00
parent 375bed1d01
commit 0b472988a2
14 changed files with 107 additions and 59 deletions

View file

@ -179,7 +179,6 @@ function handleSubmit(event = null) {
}
const date = dayjs().format();
const newComment = {
dialogUri: route.fullPath,
fileName: openedFile.value ? openedFile.value.name : false,
userUuid: user.uuid,
text: draftComment.value.text,
@ -202,7 +201,7 @@ function handleSubmit(event = null) {
async function replyComment(newComment) {
newComment.parentId = openedComment.value.id;
const matchFileParentUri = openedComment.value.location.file.url.match(
const matchFileParentUri = openedFile.value.url.match(
/projects\/.*?(?=\/[^/]+\/[^/]+$)/
);
newComment.fileParentUri = matchFileParentUri ? matchFileParentUri[0] : null;
@ -224,14 +223,16 @@ async function addComment(newComment) {
resetDraftComment();
isAddOpen.value = false;
dialog.updateFile(newFile);
activeTracks.value = activeTracks.value.map((track) => {
if (track.files) {
track.files = track.files.map((file) =>
file.uuid === newFile.uuid ? newFile : file
);
}
return track;
});
if (activeTracks.value) {
activeTracks.value = activeTracks.value.map((track) => {
if (track.files) {
track.files = track.files.map((file) =>
file.uuid === newFile.uuid ? newFile : file
);
}
return track;
});
}
}
function resetDraftComment() {
@ -318,11 +319,15 @@ function openComment(comment) {
openedComment.value = comment;
if (activeTracks.value?.length === 1) {
openedFile.value = activeTracks.value[0].files.find(
(file) => file.uuid === openedComment.value.location.file.uuid
);
showCorrespondingView();
}
}
function showCorrespondingView() {
openedFile.value = activeTracks.value[0].files.find(
(file) => file.uuid === openedComment.value.location.file.uuid
);
}
</script>
<style>