From 88278a77a01be59e683c4f0e311cdbef68176fde Mon Sep 17 00:00:00 2001 From: Anbarasu Date: Thu, 13 Jun 2024 16:59:47 +0530 Subject: [PATCH] fix: comment delete not working (#8714) * fix: missing ui acl * fix: remove unwanted ref fix: wrap condition in template --- .../smartsheet/expanded-form/Comments.vue | 53 ++++++++++++++----- .../composables/useExpandedFormStore.ts | 1 + packages/nc-gui/lib/acl.ts | 2 + 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue index fb1ef536eb..f2f05d061f 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/Comments.vue @@ -30,8 +30,6 @@ const route = useRoute() const { dashboardUrl } = useDashboard() -const editRef = ref() - const { user, appInfo } = useGlobal() const isExpandedFormLoading = computed(() => props.loading) @@ -108,6 +106,9 @@ onKeyStroke('Enter', (event) => { function editComments(comment: CommentType) { editComment.value = comment isEditing.value = true + nextTick(() => { + scrollToComment(comment.id) + }) } const value = computed({ @@ -225,6 +226,21 @@ const createdBy = ( return 'Shared source' } } + +const getUserRole = (email: string) => { + const user = baseUsers.value.find((user) => user.email === email) + if (!user) return ProjectRoles.NO_ACCESS + + return user.roles || ProjectRoles.NO_ACCESS +} + +const editedAt = (comment: CommentType) => { + if (comment.updated_at !== comment.created_at && comment.updated_at) { + const str = timeAgo(comment.updated_at).replace(' ', '_') + return `[(edited)](a~~~###~~~Edited_${str}) ` + } + return '' +}