Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a Fishbowl without introduction (#159)
* Create hasIntroduction field * Run no intro mutation created * Add unit test * unitest changes * Refactor mutation resolver tests * wip * Introduce fishbowl functional test * Add more functional tests * Add no intro fishbowl mutation in Fishbowls.js * wip * fix creation fishwbol * wip * fix button behaviour * work in progress * wip * wip * fix * space removed * wip * wip * Remove introduction sliders in onboarding * finish Fishbowl button loading fixed * unused import removed * no host users work with no introduction fishbowls * Fix refresh case * Fix stooamanager * Fishbowl type updated * New component * New Component File * Fishbowl interface prettier applied * wip to pull * add errors * Add formik field plus styles * Add value to api call * Add translations and styling * add license to fishbow.ts * Prettify * Apply prettify * wip * wip * The host user is the only one that can change the status of a fishbowl * wip * new eventsubscriber added * Add more tests * Add tooltip * Tooltip styles * Add unit tests * style fixed * New tooltip * add translations * Fix props usage * Refactor fishbowl workflow * refactor transitions * Add has introduction to sonata edit form * Tooltip for mobile * Remove run without introduction from StooaManager * Remove unused import * Add on click in tooltip * fix mobile tooltip and improve switch a11x * Fix pointer cursor Co-authored-by: Jose <jesauraoller@gmail.com>
- Loading branch information
Showing
33 changed files
with
905 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Stooa codebase. | ||
* | ||
* (c) 2020 - present Runroom SL | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20220120123411 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE fishbowl ADD has_introduction TINYINT(1) NOT NULL'); | ||
|
||
// All the Fishbowls we have created before have had and introduction. | ||
$this->addSql('UPDATE fishbowl SET has_introduction = 1'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE fishbowl DROP has_introduction'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
backend/src/EventSubscriber/FishbowlIntroduceAndNoIntroRunSubscriber.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Stooa codebase. | ||
* | ||
* (c) 2020 - present Runroom SL | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\EventSubscriber; | ||
|
||
use App\Entity\Fishbowl; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Symfony\Component\Workflow\Event\GuardEvent; | ||
use Webmozart\Assert\Assert; | ||
|
||
class FishbowlIntroduceAndNoIntroRunSubscriber implements EventSubscriberInterface | ||
{ | ||
public function guardFishbowl(GuardEvent $event): void | ||
{ | ||
$fishbowl = $event->getSubject(); | ||
|
||
Assert::isInstanceOf($fishbowl, Fishbowl::class); | ||
|
||
$transition = $event->getTransition(); | ||
|
||
if ((Fishbowl::TRANSITION_INTRODUCE === $transition->getName() && !$fishbowl->getHasIntroduction()) || | ||
(Fishbowl::TRANSITION_NO_INTRO_RUN === $transition->getName() && $fishbowl->getHasIntroduction()) | ||
) { | ||
$event->setBlocked(true); | ||
} | ||
} | ||
|
||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
'workflow.fishbowl.guard.' . Fishbowl::TRANSITION_INTRODUCE => ['guardFishbowl'], | ||
'workflow.fishbowl.guard.' . Fishbowl::TRANSITION_NO_INTRO_RUN => ['guardFishbowl'], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
backend/src/Resolver/FishbowlNoIntroRunMutationResolver.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Stooa codebase. | ||
* | ||
* (c) 2020 - present Runroom SL | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Resolver; | ||
|
||
use ApiPlatform\Core\GraphQl\Resolver\MutationResolverInterface; | ||
use App\Entity\Fishbowl; | ||
use App\Repository\FishbowlRepository; | ||
use Symfony\Component\Workflow\WorkflowInterface; | ||
|
||
class FishbowlNoIntroRunMutationResolver implements MutationResolverInterface | ||
{ | ||
private FishbowlRepository $repository; | ||
private WorkflowInterface $fishbowlStateMachine; | ||
|
||
public function __construct(FishbowlRepository $repository, WorkflowInterface $fishbowlStateMachine) | ||
{ | ||
$this->repository = $repository; | ||
$this->fishbowlStateMachine = $fishbowlStateMachine; | ||
} | ||
|
||
/** @param mixed[] $context */ | ||
public function __invoke($item, array $context): ?Fishbowl | ||
{ | ||
if (!isset($context['args']['input']['slug'])) { | ||
return null; | ||
} | ||
|
||
$fishbowl = $this->repository->findBySlug($context['args']['input']['slug']); | ||
|
||
if (null === $fishbowl) { | ||
return null; | ||
} | ||
|
||
if (!$this->fishbowlStateMachine->can($fishbowl, FISHBOWL::TRANSITION_NO_INTRO_RUN)) { | ||
return null; | ||
} | ||
|
||
$this->fishbowlStateMachine->apply($fishbowl, FISHBOWL::TRANSITION_NO_INTRO_RUN); | ||
|
||
return $fishbowl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.