Skip to content

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

fix: disable sort/filter buttons for restricted editors

Pranav C4e1825aa9801
diff --git a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue
index ab5ce26fa9..daa6e12461 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue
@@ -17,8 +17,6 @@ const { isMobileMode } = useGlobal()
const filterComp = ref<typeof ColumnFilter>()
-const { isUIAllowed } = useRoles()
-
const {
allFilters: smatsheetAllFilters,
nestedFilters,
@@ -42,7 +40,7 @@ const { nonDeletedFilters, loadFilters, canSyncFilter } = useViewFilters(
const filtersLength = ref(0)
// If view is locked OR user lacks permission to sync filters (Editor), show restricted UI
-const isRestrictedEditor = computed(() => !canSyncFilter.value)
+const isRestrictedEditor = computed(() => isLocked.value || !canSyncFilter.value)
watch(
() => activeView?.value?.id,
@@ -209,7 +207,7 @@ watch(
class="nc-filter-menu-btn nc-toolbar-btn !border-0 !h-7 group"
size="small"
type="secondary"
- :show-as-disabled="isLocked"
+ :show-as-disabled="isRestrictedEditor"
:class="{
[filteredOrSortedAppearanceConfig.FILTERED.toolbarBgClass]: combinedFilterLength,
}"
diff --git a/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue
index 3304645f2c..137b6a099c 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue
@@ -156,7 +156,7 @@ watch(
class="nc-sort-menu-btn nc-toolbar-btn !h-7 group"
size="small"
type="secondary"
- :show-as-disabled="false"
+ :show-as-disabled="isRestrictedEditor"
>
<div class="flex items-center gap-1 min-h-5">
<div class="flex items-center gap-2">