Browse Source

feat(nc-gui): only allow comment owner to edit

pull/5341/head
Wing-Kam Wong 2 years ago
parent
commit
db9b2c04ce
  1. 6
      packages/nc-gui/components/smartsheet/expanded-form/Comments.vue

6
packages/nc-gui/components/smartsheet/expanded-form/Comments.vue

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VNodeRef } from '@vue/runtime-core' import type { VNodeRef } from '@vue/runtime-core'
import type { AuditType } from 'nocodb-sdk' import type { AuditType } from 'nocodb-sdk'
import { enumColor, ref, timeAgo, useCopy, useExpandedFormStoreOrThrow, useI18n, watch } from '#imports' import { enumColor, ref, timeAgo, useCopy, useExpandedFormStoreOrThrow, useGlobal, useI18n, watch } from '#imports'
const { loadCommentsAndLogs, commentsAndLogs, isCommentsLoading, commentsOnly, saveComment, isYou, comment, updateComment } = const { loadCommentsAndLogs, commentsAndLogs, isCommentsLoading, commentsOnly, saveComment, isYou, comment, updateComment } =
useExpandedFormStoreOrThrow() useExpandedFormStoreOrThrow()
@ -16,6 +16,8 @@ const { copy } = useCopy()
const { t } = useI18n() const { t } = useI18n()
const { user } = useGlobal()
const { isUIAllowed } = useUIPermission() const { isUIAllowed } = useUIPermission()
const hasEditPermission = $computed(() => isUIAllowed('commentEditable')) const hasEditPermission = $computed(() => isUIAllowed('commentEditable'))
@ -157,7 +159,7 @@ watch(
{{ t('general.copy') }} {{ t('general.copy') }}
</div> </div>
</a-menu-item> </a-menu-item>
<a-menu-item key="edit-comment" @click="editComment(log)"> <a-menu-item v-if="log.user === user.email" key="edit-comment" @click="editComment(log)">
<div v-e="['a:comment:edit']" class="nc-project-menu-item"> <div v-e="['a:comment:edit']" class="nc-project-menu-item">
{{ t('general.edit') }} {{ t('general.edit') }}
</div> </div>

Loading…
Cancel
Save