Added HTML support to extra question labels
Change-Id: I32acb0a1c622d35844ca2b1b38ae55027db9b297 Signed-off-by: smarcet <smarcet@gmail.com>
This commit is contained in:
parent
6b35d50f9a
commit
0d6ef0b014
@ -28,15 +28,15 @@ final class ExtraQuestionTypeValueValidationRulesFactory
|
||||
|
||||
if($update){
|
||||
return [
|
||||
'label' => 'sometimes|string',
|
||||
'value' => 'sometimes|string',
|
||||
'label' => 'sometimes|string|max:255',
|
||||
'value' => 'sometimes|string|max:255',
|
||||
'order' => 'sometimes|integer|min:1'
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'label' => 'sometimes|string',
|
||||
'value' => 'required|string',
|
||||
'label' => 'sometimes|string|max:255',
|
||||
'value' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use libs\utils\HTMLCleaner;
|
||||
use models\exceptions\EntityNotFoundException;
|
||||
use models\exceptions\ValidationException;
|
||||
use models\oauth2\IResourceServerContext;
|
||||
@ -142,7 +143,7 @@ final class OAuth2SummitOrderExtraQuestionTypeApiController
|
||||
*/
|
||||
protected function addChild(Summit $summit, array $payload): IEntity
|
||||
{
|
||||
return $this->service->addOrderExtraQuestion($summit, $payload);
|
||||
return $this->service->addOrderExtraQuestion($summit, HTMLCleaner::cleanData($payload, ['label']));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,7 +189,11 @@ final class OAuth2SummitOrderExtraQuestionTypeApiController
|
||||
*/
|
||||
protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity
|
||||
{
|
||||
return $this->service->updateOrderExtraQuestion($summit, $child_id, $payload);
|
||||
return $this->service->updateOrderExtraQuestion
|
||||
(
|
||||
$summit, $child_id,
|
||||
HTMLCleaner::cleanData($payload, ['label'])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1045,7 +1045,7 @@ final class OAuth2SummitSelectionPlansApiController extends OAuth2ProtectedContr
|
||||
return SelectionPlanExtraQuestionValidationRulesFactory::build($payload);
|
||||
},
|
||||
function ($payload, $selection_plan){
|
||||
return $this->selection_plan_extra_questions_service->addExtraQuestion($selection_plan, $payload);
|
||||
return $this->selection_plan_extra_questions_service->addExtraQuestion($selection_plan, HTMLCleaner::cleanData($payload, ['label']));
|
||||
},
|
||||
...$args
|
||||
);
|
||||
@ -1093,7 +1093,7 @@ final class OAuth2SummitSelectionPlansApiController extends OAuth2ProtectedContr
|
||||
return SelectionPlanExtraQuestionValidationRulesFactory::build($payload, true);
|
||||
},
|
||||
function ($question_id, $payload, $selection_plan){
|
||||
return $this->selection_plan_extra_questions_service->updateExtraQuestion($selection_plan, $question_id, $payload);
|
||||
return $this->selection_plan_extra_questions_service->updateExtraQuestion($selection_plan, $question_id, HTMLCleaner::cleanData($payload, ['label']));
|
||||
}, ...$args);
|
||||
}
|
||||
|
||||
|
45
database/migrations/model/Version20210602181838.php
Normal file
45
database/migrations/model/Version20210602181838.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php namespace Database\Migrations\Model;
|
||||
/**
|
||||
* Copyright 2021 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema as Schema;
|
||||
/**
|
||||
* Class Version20210602181838
|
||||
* @package Database\Migrations\Model
|
||||
*/
|
||||
class Version20210602181838 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema):void
|
||||
{
|
||||
$sql = <<<SQL
|
||||
ALTER TABLE `ExtraQuestionAnswer` CHANGE `Value` `Value` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
|
||||
SQL;
|
||||
$this->addSql($sql);
|
||||
|
||||
$sql = <<<SQL
|
||||
ALTER TABLE `ExtraQuestionType` CHANGE `Label` `Label` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
|
||||
SQL;
|
||||
$this->addSql($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema):void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user