mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 03:55:59 +00:00
fix: less false positives in profanity and fix gallary nag
This commit is contained in:
@@ -92,7 +92,7 @@
|
||||
v-if="editIndex === -1"
|
||||
type="colored"
|
||||
color="brand"
|
||||
:disabled="shouldPreventActions || galleryFieldsInvalid"
|
||||
:disabled="shouldPreventActions || !canSaveGalleryFields"
|
||||
@click="createGalleryItem"
|
||||
>
|
||||
<PlusIcon aria-hidden="true" />
|
||||
@@ -102,7 +102,7 @@
|
||||
v-else
|
||||
type="colored"
|
||||
color="brand"
|
||||
:disabled="shouldPreventActions || galleryFieldsInvalid"
|
||||
:disabled="shouldPreventActions || !canSaveGalleryFields"
|
||||
@click="editGalleryItem"
|
||||
>
|
||||
<SaveIcon aria-hidden="true" />
|
||||
@@ -312,6 +312,7 @@ import {
|
||||
Textarea,
|
||||
useFormatDateTime,
|
||||
} from '@modrinth/ui'
|
||||
import { isAdmin } from '@modrinth/utils'
|
||||
import { useEventListener } from '@vueuse/core'
|
||||
|
||||
import AiImageWarningModal from '~/components/ui/AiImageWarningModal.vue'
|
||||
@@ -390,6 +391,8 @@ const galleryFieldsInvalid = computed(
|
||||
galleryTitleValidation.value.some((validation) => validation.severity === 'error') ||
|
||||
galleryDescriptionValidation.value.some((validation) => validation.severity === 'error'),
|
||||
)
|
||||
const isAdminUser = computed(() => isAdmin(currentMember.value?.user))
|
||||
const canSaveGalleryFields = computed(() => isAdminUser.value || !galleryFieldsInvalid.value)
|
||||
|
||||
// Constant for accepted file types
|
||||
const MC_SERVER_BANNER_NAME = '__mc_server_banner__'
|
||||
@@ -490,7 +493,7 @@ function showPreviewImage() {
|
||||
|
||||
// CRUD operations
|
||||
async function createGalleryItem() {
|
||||
if (galleryFieldsInvalid.value) return
|
||||
if (!canSaveGalleryFields.value) return
|
||||
shouldPreventActions.value = true
|
||||
startLoading()
|
||||
|
||||
@@ -511,7 +514,7 @@ async function createGalleryItem() {
|
||||
}
|
||||
|
||||
async function editGalleryItem() {
|
||||
if (galleryFieldsInvalid.value) return
|
||||
if (!canSaveGalleryFields.value) return
|
||||
shouldPreventActions.value = true
|
||||
startLoading()
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
v-if="editIndex === -1"
|
||||
type="colored"
|
||||
color="brand"
|
||||
:disabled="shouldPreventActions || galleryFieldsInvalid"
|
||||
:disabled="shouldPreventActions || !canSaveGalleryFields"
|
||||
@click="createGalleryItem"
|
||||
>
|
||||
<PlusIcon aria-hidden="true" />
|
||||
@@ -102,7 +102,7 @@
|
||||
v-else
|
||||
type="colored"
|
||||
color="brand"
|
||||
:disabled="shouldPreventActions || galleryFieldsInvalid"
|
||||
:disabled="shouldPreventActions || !canSaveGalleryFields"
|
||||
@click="editGalleryItem"
|
||||
>
|
||||
<SaveIcon aria-hidden="true" />
|
||||
@@ -303,6 +303,7 @@ import {
|
||||
Textarea,
|
||||
useFormatDateTime,
|
||||
} from '@modrinth/ui'
|
||||
import { isAdmin } from '@modrinth/utils'
|
||||
|
||||
import AiImageWarningModal from '~/components/ui/AiImageWarningModal.vue'
|
||||
import ValidationMessage from '~/components/ValidationMessage.vue'
|
||||
@@ -350,6 +351,8 @@ const galleryFieldsInvalid = computed(
|
||||
galleryTitleValidation.value.some((validation) => validation.severity === 'error') ||
|
||||
galleryDescriptionValidation.value.some((validation) => validation.severity === 'error'),
|
||||
)
|
||||
const isAdminUser = computed(() => isAdmin(currentMember.value?.user))
|
||||
const canSaveGalleryFields = computed(() => isAdminUser.value || !galleryFieldsInvalid.value)
|
||||
|
||||
const MC_SERVER_BANNER_NAME = '__mc_server_banner__'
|
||||
const acceptFileTypes = 'image/png,image/jpeg,image/gif,image/webp,.png,.jpeg,.gif,.webp'
|
||||
@@ -430,7 +433,7 @@ const showPreviewImage = () => {
|
||||
}
|
||||
|
||||
const createGalleryItem = async () => {
|
||||
if (galleryFieldsInvalid.value) return
|
||||
if (!canSaveGalleryFields.value) return
|
||||
shouldPreventActions.value = true
|
||||
|
||||
const success = await createGalleryItemMutation(
|
||||
@@ -449,7 +452,7 @@ const createGalleryItem = async () => {
|
||||
}
|
||||
|
||||
const editGalleryItem = async () => {
|
||||
if (galleryFieldsInvalid.value) return
|
||||
if (!canSaveGalleryFields.value) return
|
||||
shouldPreventActions.value = true
|
||||
|
||||
const success = await editGalleryItemMutation(
|
||||
|
||||
Reference in New Issue
Block a user