reply comment on 360 working

This commit is contained in:
isUnknown 2024-12-20 12:36:21 +01:00
parent d727f1a1af
commit f790653fcf
8 changed files with 38 additions and 18 deletions

View file

@ -121,7 +121,9 @@ dayjs.locale("fr");
const { user } = useUserStore();
const { page } = usePageStore();
const dialog = useDialogStore();
const { comments, openedFile, draftComment } = storeToRefs(useDialogStore());
const { comments, openedFile, draftComment, activeTracks } = storeToRefs(
useDialogStore()
);
const api = useApiStore();
const openedComment = ref(null);
@ -170,7 +172,7 @@ function handleSubmit(event = null) {
const date = dayjs().format();
const newComment = {
dialogUri: route.fullPath,
fileName: openedFile ? openedFile.value.name : false,
fileName: openedFile.value ? openedFile.value.name : false,
userUuid: user.uuid,
text: draftComment.value.text,
date,
@ -192,6 +194,10 @@ function handleSubmit(event = null) {
async function replyComment(newComment) {
newComment.parentId = openedComment.value.id;
const matchFileParentUri = openedComment.value.location.file.url.match(
/projects\/.*?(?=\/[^/]+\/[^/]+$)/
);
newComment.fileParentUri = matchFileParentUri ? matchFileParentUri[0] : null;
const newFile = await api.replyComment(newComment);
resetDraftComment();
isAddOpen.value = false;
@ -292,6 +298,12 @@ function prepareDraftCommentInImage(event) {
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
);
}
}
</script>