Skip to content

Commit 5049f6f

Browse files
authored
fix: team environment user access bug (hoppscotch#5149)
1 parent 9ef2c46 commit 5049f6f

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

packages/hoppscotch-common/src/components/environments/Selector.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
:placeholder="`${t('action.search')}`"
3636
:context-menu-enabled="false"
3737
class="border border-dividerDark focus:border-primaryDark rounded"
38-
:readonly="isFilterInputDisabled"
3938
/>
4039
<HoppSmartItem
4140
v-if="!isScopeSelector"
@@ -701,14 +700,6 @@ const editGlobalEnv = () => {
701700
invokeAction("modals.global.environment.update", {})
702701
}
703702
704-
// Filter input disabled if no environments are available
705-
const isFilterInputDisabled = computed(() => {
706-
if (selectedEnvTab.value === "my-environments") {
707-
return myEnvironments.value.length === 0
708-
}
709-
return teamEnvironmentList.value.length === 0
710-
})
711-
712703
const editEnv = () => {
713704
if (selectedEnv.value.type === "MY_ENV" && selectedEnv.value.name) {
714705
invokeAction("modals.my.environment.edit", {

packages/hoppscotch-common/src/components/environments/my/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
autocomplete="off"
77
class="flex w-full bg-transparent px-4 py-2 h-8 border-b border-dividerLight"
88
:placeholder="t('action.search')"
9-
:disabled="!environments.length"
109
/>
1110
<div
1211
class="sticky top-upperPrimaryStickyFold z-10 flex flex-1 flex-shrink-0 justify-between overflow-x-auto border-b border-dividerLight bg-primary"

packages/hoppscotch-common/src/components/environments/teams/Details.vue

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@
8888
:placeholder="`${t('count.variable', {
8989
count: index + 1,
9090
})}`"
91-
:name="'param' + index"
91+
:class="{
92+
'opacity-25': isViewer,
93+
}"
94+
:name="'variable' + index"
9295
:disabled="isViewer"
9396
/>
9497
<SmartEnvInput
@@ -100,6 +103,7 @@
100103
:select-text-on-mount="
101104
env.key ? env.key === editingVariableName : false
102105
"
106+
:readonly="isViewer"
103107
/>
104108
<SmartEnvInput
105109
v-model="env.currentValue"
@@ -495,8 +499,13 @@ const saveEnvironment = async () => {
495499
secretVariables
496500
)
497501
502+
currentEnvironmentValueService.addEnvironment(
503+
editingID.value,
504+
nonSecretVariables
505+
)
506+
498507
// If the user is a viewer, we don't need to update the environment in BE
499-
// just update the secret environment in the local storage
508+
// just update the secret environment and current environment in the local storage
500509
if (props.isViewer) {
501510
hideModal()
502511
toast.success(`${t("environment.updated")}`)
@@ -521,12 +530,6 @@ const saveEnvironment = async () => {
521530
toast.success(`${t("environment.updated")}`)
522531
523532
isLoading.value = false
524-
if (editingID.value) {
525-
currentEnvironmentValueService.addEnvironment(
526-
editingID.value,
527-
nonSecretVariables
528-
)
529-
}
530533
}
531534
)
532535
)()

packages/hoppscotch-common/src/components/environments/teams/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
autocomplete="off"
77
class="flex w-full bg-transparent px-4 py-2 h-8 border-b border-dividerLight"
88
:placeholder="t('action.search')"
9-
:disabled="loading || !teamEnvironments.length"
9+
:disabled="loading"
1010
/>
1111
<div
1212
class="sticky top-upperPrimaryStickyFold z-10 flex flex-1 flex-shrink-0 justify-between overflow-x-auto border-b border-dividerLight bg-primary"

0 commit comments

Comments
 (0)