You've already forked AstralRinth
forked from didirus/AstralRinth
Fixed permissions issue and modpack issue with environment overhaul
This commit is contained in:
@@ -764,7 +764,16 @@
|
||||
>
|
||||
{{ formatMessage(messages.environmentMigrationMessage) }}
|
||||
<ButtonStyled color="orange">
|
||||
<nuxt-link :to="`/project/${project.id}/settings/environment`" class="mt-3 w-fit">
|
||||
<nuxt-link
|
||||
v-tooltip="
|
||||
hasEditDetailsPermission
|
||||
? undefined
|
||||
: formatMessage(commonProjectSettingsMessages.noPermissionDescription)
|
||||
"
|
||||
:to="`/project/${project.id}/settings/environment`"
|
||||
class="mt-3 w-fit"
|
||||
:disabled="!hasEditDetailsPermission"
|
||||
>
|
||||
<SettingsIcon /> {{ formatMessage(messages.reviewEnvironmentSettings) }}
|
||||
</nuxt-link>
|
||||
</ButtonStyled>
|
||||
@@ -957,6 +966,7 @@ import {
|
||||
ButtonStyled,
|
||||
Checkbox,
|
||||
commonMessages,
|
||||
commonProjectSettingsMessages,
|
||||
injectNotificationManager,
|
||||
NewModal,
|
||||
OverflowMenu,
|
||||
@@ -1589,6 +1599,11 @@ const currentMember = computed(() => {
|
||||
return val
|
||||
})
|
||||
|
||||
const hasEditDetailsPermission = computed(() => {
|
||||
const EDIT_DETAILS = 1 << 2
|
||||
return (currentMember.value?.permissions & EDIT_DETAILS) === EDIT_DETAILS
|
||||
})
|
||||
|
||||
versions.value = data.$computeVersions(versions.value, allMembers.value)
|
||||
|
||||
// Q: Why do this instead of computing the versions of featuredVersions?
|
||||
@@ -1870,6 +1885,7 @@ provideProjectPageContext({
|
||||
projectV2: project,
|
||||
projectV3,
|
||||
refreshProject: resetProject,
|
||||
currentMember,
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { defineMessages, useVIntl } from '@vintl/vintl'
|
||||
|
||||
const { formatMessage } = useVIntl()
|
||||
|
||||
const { projectV2, projectV3, refreshProject } = injectProjectPageContext()
|
||||
const { currentMember, projectV2, projectV3, refreshProject } = injectProjectPageContext()
|
||||
const { handleError } = injectNotificationManager()
|
||||
const api = injectApi()
|
||||
|
||||
@@ -32,6 +32,11 @@ const needsToVerify = computed(
|
||||
supportsEnvironment.value,
|
||||
)
|
||||
|
||||
const hasPermission = computed(() => {
|
||||
const EDIT_DETAILS = 1 << 2
|
||||
return (currentMember.value?.permissions & EDIT_DETAILS) === EDIT_DETAILS
|
||||
})
|
||||
|
||||
function getInitialEnv() {
|
||||
return projectV3.value.environment?.length === 1 ? projectV3.value.environment[0] : undefined
|
||||
}
|
||||
@@ -106,7 +111,7 @@ const messages = defineMessages({
|
||||
<template>
|
||||
<div>
|
||||
<UnsavedChangesPopup
|
||||
v-if="supportsEnvironment"
|
||||
v-if="supportsEnvironment && hasPermission"
|
||||
:original="saved"
|
||||
:modified="current"
|
||||
:saving="saving"
|
||||
@@ -125,40 +130,43 @@ const messages = defineMessages({
|
||||
v-if="!supportsEnvironment"
|
||||
type="critical"
|
||||
:header="formatMessage(messages.wrongProjectTypeTitle)"
|
||||
:body="formatMessage(messages.wrongProjectTypeDescription)"
|
||||
class="mb-3"
|
||||
>
|
||||
{{ formatMessage(messages.wrongProjectTypeDescription) }}
|
||||
</Admonition>
|
||||
/>
|
||||
<template v-else>
|
||||
<Admonition
|
||||
v-if="
|
||||
v-if="!hasPermission"
|
||||
type="critical"
|
||||
:header="formatMessage(commonProjectSettingsMessages.noPermissionTitle)"
|
||||
:body="formatMessage(commonProjectSettingsMessages.noPermissionDescription)"
|
||||
class="mb-3"
|
||||
/>
|
||||
<Admonition
|
||||
v-else-if="
|
||||
!projectV3.environment ||
|
||||
projectV3.environment.length === 0 ||
|
||||
projectV3.environment[0] === 'unknown'
|
||||
"
|
||||
type="critical"
|
||||
:header="formatMessage(messages.missingEnvTitle)"
|
||||
:body="formatMessage(messages.missingEnvDescription)"
|
||||
class="mb-3"
|
||||
>
|
||||
{{ formatMessage(messages.missingEnvDescription) }}
|
||||
</Admonition>
|
||||
/>
|
||||
<Admonition
|
||||
v-else-if="projectV3.environment.length > 1"
|
||||
type="info"
|
||||
:header="formatMessage(messages.multipleEnvironmentsTitle)"
|
||||
:body="formatMessage(messages.multipleEnvironmentsDescription)"
|
||||
class="mb-3"
|
||||
>
|
||||
{{ formatMessage(messages.multipleEnvironmentsDescription) }}
|
||||
</Admonition>
|
||||
/>
|
||||
<Admonition
|
||||
v-else-if="needsToVerify"
|
||||
type="warning"
|
||||
:header="formatMessage(messages.reviewOptionsTitle)"
|
||||
:body="formatMessage(messages.reviewOptionsDescription)"
|
||||
class="mb-3"
|
||||
>
|
||||
{{ formatMessage(messages.reviewOptionsDescription) }}
|
||||
</Admonition>
|
||||
<ProjectSettingsEnvSelector v-model="current.environment" />
|
||||
/>
|
||||
<ProjectSettingsEnvSelector v-model="current.environment" :disabled="!hasPermission" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -456,9 +456,8 @@ if (user.value?.projects) {
|
||||
projects.value = updateSort(user.value.projects, 'Name', false)
|
||||
user.value?.projectsV3?.forEach((project) => {
|
||||
if (
|
||||
(project.side_types_migration_review_status === 'pending' &&
|
||||
project.project_types.includes('mod')) ||
|
||||
project.project_types.includes('modpack')
|
||||
project.side_types_migration_review_status === 'pending' &&
|
||||
(project.project_types.includes('mod') || project.project_types.includes('modpack'))
|
||||
) {
|
||||
projectsWithMigrationWarning.value.push(project.id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user