Skip to content

Commit

Permalink
[Slack][Equipment Authorization] Remove redundant empty form informat…
Browse files Browse the repository at this point in the history
…ion (#52)

Removes the "Please select at least one member..." and "Please select at least one piece of equipment..." since those fields already have error messages when empty.
  • Loading branch information
chungl authored Jan 18, 2024
1 parent 69cd43d commit c90f632
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions app/External/Slack/Modals/EquipmentAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ class EquipmentAuthorization implements ModalInterface
private Modal $modalView;

public function __construct()
{
$this->setUpModalCommon();

$this->noEquipment();
$this->noPerson();
}

private function setUpModalCommon()
{
$this->modalView = Kit::newModal()
->callbackId(self::callbackId())
Expand Down Expand Up @@ -181,20 +173,11 @@ public function jsonSerialize()
public static function onBlockAction(SlackRequest $request)
{
$modal = new EquipmentAuthorization();
$modal->setUpModalCommon();

$state = self::getStateValues($request);

$selectedEquipment = self::equipmentFromState($state);
$selectedMembers = self::peopleFromState($state);

if (empty($selectedEquipment)) {
$modal->noEquipment();
}

if (empty($selectedMembers)) {
$modal->noPerson();
}

if (! empty($selectedEquipment) && ! empty($selectedMembers)) {
// Render information about any selected people who have existing permisisons for this equipment.
Expand Down Expand Up @@ -238,16 +221,4 @@ public static function onBlockAction(SlackRequest $request)

return $modal->updateViaApi($request);
}

private function noEquipment()
{
$this->modalView->newSection()
->mrkdwnText("Please select at least one piece of equipment above.");
}

private function noPerson()
{
$this->modalView->newSection()
->mrkdwnText("Please select at least one member to authorize.");
}
}

0 comments on commit c90f632

Please sign in to comment.