Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix(common): subfolder add-new in team collections respects write access (#6243)

Nivedinaee017ced338
diff --git a/packages/hoppscotch-common/src/components/collections/TeamCollections.vue b/packages/hoppscotch-common/src/components/collections/TeamCollections.vue
index bd74b6795..3a56c3a27 100644
--- a/packages/hoppscotch-common/src/components/collections/TeamCollections.vue
+++ b/packages/hoppscotch-common/src/components/collections/TeamCollections.vue
@@ -486,12 +486,16 @@
:label="t('add.new')"
filled
outline
+ :disabled="hasNoTeamAccess"
+ :title="hasNoTeamAccess ? t('team.no_access') : ''"
@click="
- node.data.type === 'collections' &&
- emit('add-folder', {
- path: node.id,
- folder: node.data.data.data,
- })
+ hasNoTeamAccess
+ ? null
+ : node.data.type === 'collections' &&
+ emit('add-folder', {
+ path: node.id,
+ folder: node.data.data.data,
+ })
"
/>
</template>
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index d850b3a25..9ef25a871 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -1051,6 +1051,13 @@ const addFolder = (payload: {
path: string
folder: HoppCollection | TeamCollection
}) => {
+ if (
+ collectionsType.value.type === "team-collections" &&
+ !hasTeamWriteAccess.value
+ ) {
+ return
+ }
+
const { path, folder } = payload
editingFolder.value = folder
editingFolderPath.value = path