Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: enable kanban view updates for personal view owners

Pranav C20366101ae88
diff --git a/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue b/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue
index d620db8c3c..217a758528 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/MappedBy.vue
@@ -66,7 +66,11 @@ const handleChange = () => {
<template>
<a-dropdown v-if="!IsPublic" v-model:visible="mappedByDropdown" :trigger="['click']" class="!xs:hidden">
<div class="nc-map-btn">
- <a-button v-e="['c:map:change-grouping-field']" class="nc-map-stacked-by-menu-btn nc-toolbar-btn" :disabled="isRestrictedEditor">
+ <a-button
+ v-e="['c:map:change-grouping-field']"
+ class="nc-map-stacked-by-menu-btn nc-toolbar-btn"
+ :disabled="isRestrictedEditor"
+ >
<div class="flex items-center gap-1">
<mdi-arrow-down-drop-circle-outline />
<span class="text-capitalize !text-sm font-weight-normal">
diff --git a/packages/nc-gui/composables/useKanbanViewStore.ts b/packages/nc-gui/composables/useKanbanViewStore.ts
index 48d586288e..8ed2a299e2 100644
--- a/packages/nc-gui/composables/useKanbanViewStore.ts
+++ b/packages/nc-gui/composables/useKanbanViewStore.ts
@@ -1,5 +1,5 @@
import type { ComputedRef, Ref } from 'vue'
-import { EventType, ViewTypes } from 'nocodb-sdk'
+import { EventType, ViewLockType, ViewTypes } from 'nocodb-sdk'
import type {
Api,
ColumnType,
@@ -46,6 +46,8 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
const { isUIAllowed } = useRoles()
+ const { user } = useGlobal()
+
/**
* In shared view mode, `isPublic` will still be false because both
* `useProvideSmartsheetStore` and `provide(IsPublicInj)` are called at the same
@@ -65,8 +67,6 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
const { setMeta, metas } = useMetas()
- const { user } = useGlobal()
-
// save history of stack changes for undo/redo
const moveHistory = ref<{ op: 'added' | 'removed'; pk: string; stack: string; index: number }[]>([])
@@ -332,8 +332,14 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
async function updateKanbanMeta(updateObj: Partial<KanbanType>) {
if (!viewMeta?.value?.id) return
+
+ // Check if user can update based on role OR personal view ownership
+ const isPersonalViewOwner = viewMeta.value.lock_type === ViewLockType.Personal && viewMeta.value.owned_by === user.value?.id
+
+ const canUpdate = isUIAllowed('viewCreateOrEdit', { skipSourceCheck: true }) || isPersonalViewOwner
+
await updateViewMeta(viewMeta.value.id, ViewTypes.KANBAN, updateObj, {
- skipNetworkCall: isPublic.value || !isUIAllowed('viewCreateOrEdit', { skipSourceCheck: true }),
+ skipNetworkCall: isPublic.value || !canUpdate,
})
}