mirror of
https://github.com/fergalmoran/onearmy-community-platform.git
synced 2025-12-22 09:37:54 +00:00
chore: do not require approval on an already accepted howto (#3614)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { faker } from '@faker-js/faker'
|
||||
import { DifficultyLevel } from 'oa-shared'
|
||||
import { DifficultyLevel, IModerationStatus } from 'oa-shared'
|
||||
|
||||
import {
|
||||
HOWTO_STEP_DESCRIPTION_MAX_LENGTH,
|
||||
@@ -109,6 +109,7 @@ describe('[How To]', () => {
|
||||
_deleted: false,
|
||||
category: 'Moulds',
|
||||
description: 'After creating, the how-to will be deleted',
|
||||
moderation: IModerationStatus.AWAITING_MODERATION,
|
||||
difficulty_level: DifficultyLevel.MEDIUM,
|
||||
time: '1-2 weeks',
|
||||
title: 'Create a how-to test',
|
||||
@@ -361,6 +362,7 @@ describe('[How To]', () => {
|
||||
_createdBy: 'howto_editor',
|
||||
_deleted: false,
|
||||
category: 'exhibition',
|
||||
moderation: IModerationStatus.ACCEPTED,
|
||||
description: 'After editing, all changes are reverted',
|
||||
difficulty_level: DifficultyLevel.HARD,
|
||||
files: [],
|
||||
|
||||
@@ -45,6 +45,7 @@ const eqHowto = (chaiObj) => {
|
||||
title,
|
||||
tags,
|
||||
previousSlugs,
|
||||
moderation,
|
||||
} = expected
|
||||
expect(subject, 'Basic info').to.containSubset({
|
||||
_createdBy,
|
||||
@@ -59,6 +60,8 @@ const eqHowto = (chaiObj) => {
|
||||
})
|
||||
expect(subject.category.label, 'Category').to.eq(category)
|
||||
|
||||
expect(subject.moderation).to.equal(moderation)
|
||||
|
||||
// We want to validate that uploaded filename matches that originally specified
|
||||
// by the user. The filename will include a timestamp to avoid collisions with
|
||||
// existing files that have been uploaded.
|
||||
|
||||
@@ -94,9 +94,11 @@ export const HowtoForm = observer((props: IProps) => {
|
||||
return
|
||||
}
|
||||
setState((state) => ({ ...state, showSubmitModal: true }))
|
||||
if (formValues.moderation !== IModerationStatus.ACCEPTED) {
|
||||
formValues.moderation = formValues.allowDraftSave
|
||||
? IModerationStatus.DRAFT
|
||||
: IModerationStatus.AWAITING_MODERATION
|
||||
}
|
||||
logger.debug('submitting form', formValues)
|
||||
await howtoStore.uploadHowTo(formValues)
|
||||
form.reset(formValues)
|
||||
|
||||
Reference in New Issue
Block a user