Skip to content

Commit

Permalink
Merge pull request #226 from helsingborg-stad/revert-225-feature/requ…
Browse files Browse the repository at this point in the history
…ire-image

Fix: revert "Feature/require image"
  • Loading branch information
NiclasNorin authored Oct 5, 2023
2 parents b273232 + 2373e9e commit b505d84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions source/js/front/form-submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ const eventFormSubmit = {
imageData.append('file', imageInput.files[0]);

const formRequests = [];
formRequests.push(eventFormSubmit.submitImageData(imageData));
if (imageInput.files[0]) {
formRequests.push(eventFormSubmit.submitImageData(imageData));
} else {
formRequests.push(null);
}

const formUserGroups = formData.user_groups.join(',');

Expand Down Expand Up @@ -83,7 +87,7 @@ const eventFormSubmit = {
formData['location'] = locationResponse.data.id;
}

const errorResponses = [imageResponse, organizerResponse, locationResponse].filter(x => !Array.isArray(x) && !x.success).map(x => x.data);
const errorResponses = [organizerResponse, locationResponse].filter(x => !Array.isArray(x) && !x.success).map(x => x.data);
if (!errorResponses.length > 0) {
eventFormSubmit.submitFormData(formData, 'submit_event').then(response => {
if (response.success) {
Expand Down
2 changes: 1 addition & 1 deletion source/php/Module/EventForm/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function get(?int $id = 0)
) . '<br>' .
__('You must also have the right to use and distribute the image.', 'event-integration'),
'type' => 'image',
'required' => true,
'required' => !empty($data['image_input']['required']),
'aspectRatio' => '16:9'
],
[
Expand Down

0 comments on commit b505d84

Please sign in to comment.