a couple of random FE2 fixes reported on Discord (#1943)
* fix(fe2): clearer error msg on failed upload * fix(fe2): missing project.commentThreads access w/ admin override
This commit is contained in:
committed by
GitHub
parent
36f749b24a
commit
a563fa27c7
@@ -23,7 +23,7 @@
|
||||
v-if="errorMessage"
|
||||
class="text-danger inline-flex space-x-1 items-center text-center"
|
||||
>
|
||||
<ExclamationTriangleIcon class="h-4 w-4" />
|
||||
<ExclamationTriangleIcon class="h-4 w-4 shrink-0" />
|
||||
<span>{{ errorMessage }}</span>
|
||||
</span>
|
||||
<div
|
||||
|
||||
@@ -51,6 +51,16 @@ export function importFile(
|
||||
})
|
||||
|
||||
request.addEventListener('load', () => {
|
||||
if (!request.response) {
|
||||
return rejectResponse(
|
||||
new Error(
|
||||
`Upload failed${
|
||||
request.status ? ' with code ' + request.status : ''
|
||||
} - no response`
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
const uploadResults =
|
||||
(request.response as Optional<PostBlobResponse>)?.uploadResults || []
|
||||
const result = uploadResults.find((r) => r.formKey === formKey)
|
||||
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
formatSerializedViewerState,
|
||||
inputToDataStruct
|
||||
} from '@/modules/comments/services/data'
|
||||
import { adminOverrideEnabled } from '@/modules/shared/helpers/envHelper'
|
||||
|
||||
export async function authorizeProjectCommentsAccess(params: {
|
||||
projectId: string
|
||||
@@ -60,6 +61,7 @@ export async function authorizeProjectCommentsAccess(params: {
|
||||
if (!project.isPublic && !project.role) success = false
|
||||
if (requireProjectRole && !project.role && !project.allowPublicComments)
|
||||
success = false
|
||||
if (adminOverrideEnabled() && authCtx.role === Roles.Server.Admin) success = true
|
||||
|
||||
if (!success) {
|
||||
throw new StreamInvalidAccessError('You are not authorized')
|
||||
|
||||
Reference in New Issue
Block a user