Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

APP_TIMEZONE=UTC
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
Expand Down Expand Up @@ -40,7 +41,7 @@ MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_SCHEME=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.*
Expand Down Expand Up @@ -129,3 +130,4 @@ storage/backups
cron-fail.log
.DS_Store
.phpunit.cache/
/.nova
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GenerateVendingNetJournalEntryCommand extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
if (! QuickBooksAuthSettings::hasKnownAuth()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/QuickBooks/RefreshAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RefreshAccessToken extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
if (! QuickBooksAuthSettings::hasKnownAuth()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Stripe/TopUpIssuingBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TopUpIssuingBalance extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
// This code should only be temporary until we have the full system built out to manage current issuing balance

Expand Down
4 changes: 2 additions & 2 deletions app/External/Slack/Modals/CountdownTestModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(?int $timeLeft)
blocks: [
Kit::section(
text: 'This is a test to see how responsive something like a countdown is.'
)
),
],
);

Expand All @@ -41,7 +41,7 @@ public function __construct(?int $timeLeft)
actionId: self::START_COUNTDOWN,
text: 'Start Countdown',
style: ButtonStyle::PRIMARY,
)
),
],
blockId: self::START_COUNTDOWN
),
Expand Down
8 changes: 4 additions & 4 deletions app/External/Slack/Modals/CreateTrainableEquipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

class CreateTrainableEquipment implements ModalInterface
{
use ModalTrait;
use HasExternalOptions;
use ModalTrait;

private const EQUIPMENT_NAME = 'equipment-name';

Expand Down Expand Up @@ -71,8 +71,8 @@ public function __construct(?Customer $user)
Kit::context(
elements: [
Kit::plainText(
text: 'Users/trainers will be automatically added to these channels/emails. All are ' .
'optional. Email must be an existing group, for now. Please ask in #general and we\'ll ' .
text: 'Users/trainers will be automatically added to these channels/emails. All are '.
'optional. Email must be an existing group, for now. Please ask in #general and we\'ll '.
'help make one if needed.'
),
],
Expand Down Expand Up @@ -123,7 +123,7 @@ public static function callbackId(): string
public static function handle(SlackRequest $request): JsonResponse
{
if (! $request->customer()->hasMembership(UserMembership::MEMBERSHIP_META_TRAINER)) {
Log::warning('CreateTrainableEquipment: Rejecting unauthorized submission from user ' . $request->customer()->id);
Log::warning('CreateTrainableEquipment: Rejecting unauthorized submission from user '.$request->customer()->id);
throw new \Exception('Unauthorized');
}

Expand Down
20 changes: 10 additions & 10 deletions app/External/Slack/Modals/EquipmentAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

class EquipmentAuthorization implements ModalInterface
{
use HasExternalOptions;
use ModalTrait;
use RespondsToBlockActions;
use HasExternalOptions;

private const EQUIPMENT_DROPDOWN = 'equipment-dropdown';

Expand Down Expand Up @@ -121,7 +121,7 @@ public static function handle(SlackRequest $request): JsonResponse
]);
}

return (new SuccessModal("Authorization submitted!"))->update();
return (new SuccessModal('Authorization submitted!'))->update();
}

/**
Expand All @@ -140,7 +140,7 @@ public static function getBlockActions(): array
public static function equipmentFromState($state): Collection
{
$equipmentIds = array_map(
fn($formValue) => str_replace('equipment-', '', $formValue),
fn ($formValue) => str_replace('equipment-', '', $formValue),
$state[self::EQUIPMENT_DROPDOWN][self::EQUIPMENT_DROPDOWN] ?? []
);

Expand All @@ -150,7 +150,7 @@ public static function equipmentFromState($state): Collection
public static function peopleFromState($state): Collection
{
$customerIds = array_map(
fn($formValue) => str_replace('customer-', '', $formValue),
fn ($formValue) => str_replace('customer-', '', $formValue),
$state[self::PERSON_DROPDOWN][self::PERSON_DROPDOWN] ?? []
);

Expand Down Expand Up @@ -188,16 +188,16 @@ public static function onBlockAction(SlackRequest $request)

// Get names of equipment for which the member is already a user
$trainedEquipmentNames = $selectedEquipment
->where(fn($e) => $person->hasMembership($e->user_plan_id))
->map(fn($e) => $e->name);
->where(fn ($e) => $person->hasMembership($e->user_plan_id))
->map(fn ($e) => $e->name);
if ($trainedEquipmentNames->isNotEmpty()) {
$alreadyTrained[$traineeName] = $trainedEquipmentNames;
}

// Get names of equipment for which the member is already a trainer
$trainerForEquipmentNames = $selectedEquipment
->where(fn($e) => $person->hasMembership($e->trainer_plan_id))
->map(fn($e) => $e->name);
->where(fn ($e) => $person->hasMembership($e->trainer_plan_id))
->map(fn ($e) => $e->name);
if ($trainerForEquipmentNames->isNotEmpty()) {
$alreadyTrainers[$traineeName] = $trainerForEquipmentNames;
}
Expand All @@ -217,7 +217,7 @@ public static function onBlockAction(SlackRequest $request)
$modal->modalView->blocks(
Kit::context(
elements: [
Kit::mrkdwnText($trainee . ' is already trained on ' . $equipmentNames->join(', ')),
Kit::mrkdwnText($trainee.' is already trained on '.$equipmentNames->join(', ')),
],
),
);
Expand All @@ -227,7 +227,7 @@ public static function onBlockAction(SlackRequest $request)
$modal->modalView->blocks(
Kit::context(
elements: [
Kit::mrkdwnText($trainer . ' is already a trainer for ' . $equipmentNames->join(', ')),
Kit::mrkdwnText($trainer.' is already a trainer for '.$equipmentNames->join(', ')),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion app/External/Slack/Modals/HasExternalOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

trait HasExternalOptions
{
public abstract static function getExternalOptions(SlackRequest $request): OptionsResult;
abstract public static function getExternalOptions(SlackRequest $request): OptionsResult;
}
12 changes: 6 additions & 6 deletions app/External/Slack/Modals/ManageOpenHouseModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct()
foreach (Door::all() as $door) {
$doorCheckboxOptions->append(Kit::option(
text: $door->humanReadableName,
value: 'device-' . $door->dsxDeviceId,
value: 'device-'.$door->dsxDeviceId,
initial: $door->openDuringOpenHouseByDefault
));
}
Expand Down Expand Up @@ -74,12 +74,12 @@ public static function callbackId(): string
public static function handle(SlackRequest $request): JsonResponse
{
if (! $request->customer()->canIDcheck()) {
Log::warning('ManageOpenHouseModal: Rejecting unauthorized submission from user ' . $request->customer()->id);
Log::warning('ManageOpenHouseModal: Rejecting unauthorized submission from user '.$request->customer()->id);
throw new \Exception('Unauthorized');
}

$values = $request->payload()['view']['state']['values'];
Log::info('Manage open house modal: ' . print_r($values, true));
Log::info('Manage open house modal: '.print_r($values, true));

$selectedTime = $values[self::EXPIRES_TIME][self::EXPIRES_TIME]['selected_time'];
$selectedOptions = collect($values[self::DOORS][self::DOORS]['selected_options'])
Expand All @@ -89,13 +89,13 @@ public static function handle(SlackRequest $request): JsonResponse

$selectedTimeCarbon = now()->tz('America/Denver');
$selectedTime = explode(':', $selectedTime);
$selectedTimeCarbon->hour = (int)$selectedTime[0];
$selectedTimeCarbon->minute = (int)$selectedTime[1];
$selectedTimeCarbon->hour = (int) $selectedTime[0];
$selectedTimeCarbon->minute = (int) $selectedTime[1];

$doors = Door::all();
/** @var Door $door */
foreach ($doors as $door) {
$shouldOpen = $selectedOptions->contains('device-' . $door->dsxDeviceId);
$shouldOpen = $selectedOptions->contains('device-'.$door->dsxDeviceId);
if ($selectedOptions->contains(self::CLOSE_ALL_DOORS)) {
$door->shouldOpen(false);
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/External/Slack/Modals/ManageVolunteerGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function __construct()
submit: 'Submit',
blocks: [
Kit::section(
text: "This feature is not yet implemented.",
)
text: 'This feature is not yet implemented.',
),
]
);
}
Expand Down
6 changes: 3 additions & 3 deletions app/External/Slack/Modals/MembershipOptionsModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct(?Customer $customer)
placeholder: 'Select an item',
options: $membershipOptions,
),
)
),
]
);

Expand All @@ -81,15 +81,15 @@ public static function handle(SlackRequest $request): JsonResponse
break;
case self::QUICK_OPEN_HOUSE_VALUE:
if (! $request->customer()->canIDcheck()) {
Log::warning('QuickOpenHouse: Rejecting unauthorized submission from user ' . $request->customer()->id);
Log::warning('QuickOpenHouse: Rejecting unauthorized submission from user '.$request->customer()->id);
throw new \Exception('Unauthorized');
}
Door::quickOpenHouse();

return self::clearViewStack();
case self::ALL_DOORS_DEFAULT_VALUE:
if (! $request->customer()->canIDcheck()) {
Log::warning('QuickOpenHouse: Rejecting unauthorized submission from user ' . $request->customer()->id);
Log::warning('QuickOpenHouse: Rejecting unauthorized submission from user '.$request->customer()->id);
throw new \Exception('Unauthorized');
}
Door::quickDefaultDoors();
Expand Down
4 changes: 2 additions & 2 deletions app/External/Slack/Modals/NeedIdCheckModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct()
placeholder: 'Select a Customer',
options: $customers
),
)
),
],
);
}
Expand All @@ -66,7 +66,7 @@ public static function callbackId(): string
public static function handle(SlackRequest $request): JsonResponse
{
if (! $request->customer()->canIDcheck()) {
Log::warning('NeedIdCheckModal: Rejecting unauthorized submission from user ' . $request->customer()->id);
Log::warning('NeedIdCheckModal: Rejecting unauthorized submission from user '.$request->customer()->id);
throw new \Exception('Unauthorized');
}

Expand Down
4 changes: 2 additions & 2 deletions app/External/Slack/Modals/NewMemberIdCheckModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($customer_id)
);
} else {
$membershipWaiverSection = Kit::section(
text: Kit::mrkdwnText(':x: No waiver found.'), # TODO see next page after ID check
text: Kit::mrkdwnText(':x: No waiver found.'), // TODO see next page after ID check
);
}

Expand Down Expand Up @@ -85,7 +85,7 @@ public function __construct($customer_id)
),
Kit::section(
text: Kit::plainText(
'The numbers on the card will look like either "12345 3300687-1" or "175-012345" and ' .
'The numbers on the card will look like either "12345 3300687-1" or "175-012345" and '.
'you should enter "12345" in this field.',
),
),
Expand Down
8 changes: 4 additions & 4 deletions app/External/Slack/Modals/NewMemberInfoModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class NewMemberInfoModal implements ModalInterface
use ModalTrait;

private const INFO = [
"This is a community. You are a member, not a customer. This organization runs on the contributions of its members.",
'This is a community. You are a member, not a customer. This organization runs on the contributions of its members.',
"We're a drug and alcohol free space. There is hazardous equipment here, always keep everyone's safety in mind.",
"Don't live or sleep at the space. That includes in the parking lot. Don't leave your car in the lot overnight.",
"There are other tenants in the building. Don't go upstairs except for the gender neutral bathroom since there's not one on the first floor. Close denhac doors if no one else is in the room. The exterior doors are unlocked randomly throughout the day.",
"Slack has many channels you can join. Channels prefixed with help- are a good place to start to ask for training on equipment. Channels prefixed with sig- are a good place to start volunteering and get involved. Reply in threads to make channels easier to follow.",
'Slack has many channels you can join. Channels prefixed with help- are a good place to start to ask for training on equipment. Channels prefixed with sig- are a good place to start volunteering and get involved. Reply in threads to make channels easier to follow.',
"Read all signs everywhere and abide by them. Also read the wiki. If something isn't in the wiki, add it. Check out the How To page on our website, it provides some information on 'How to be a denhac member' essentially.",
"No Harassment or Bullying: This includes, but is not limited to, attention that comes after a request to stop. Recognize and respect everyone's differences. Treat all members with kindness and respect. Our anti-harassment policy is part of the member agreement you've agreed to - please read it.",
"The last Saturday of the month is Hack denhac Day. The space is closed for personal project work. Come help us work on the space.",
"Leave the space better than you found it. Take out the trash. Communicate any issues through Slack.",
'The last Saturday of the month is Hack denhac Day. The space is closed for personal project work. Come help us work on the space.',
'Leave the space better than you found it. Take out the trash. Communicate any issues through Slack.',
];

public function __construct()
Expand Down
14 changes: 7 additions & 7 deletions app/External/Slack/Modals/OpenDoorModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct()
foreach (Door::all() as $door) {
$doorButtonOptions->append(Kit::option(
text: $door->humanReadableName,
value: 'device-' . $door->dsxDeviceId,
value: 'device-'.$door->dsxDeviceId,
));
}

Expand Down Expand Up @@ -57,13 +57,13 @@ public static function handle(SlackRequest $request): JsonResponse
{
$customer = $request->customer();
$values = $request->payload()['view']['state']['values'];
Log::info('Open Door Modal: ' . print_r($values, true));
Log::info('Open Door Modal: '.print_r($values, true));

$selectedOption = collect($values[self::DOORS][self::DOORS]['selected_option']);

/** @var Door $door */
$door = Door::all()
->filter(fn($door) => $selectedOption['value'] == 'device-' . $door->dsxDeviceId)
->filter(fn ($door) => $selectedOption['value'] == 'device-'.$door->dsxDeviceId)
->first();

if (is_null($door)) {
Expand All @@ -76,10 +76,10 @@ public static function handle(SlackRequest $request): JsonResponse

$earliestAllowedTimestamp = Carbon::now()->subMinutes(5)->getTimestamp();
$atTheSpace = $accessLogs
->where('user_id', $customer->slack_id)
->where('ip', setting('ip.space'))
->filter(fn($data) => $data['date_last'] >= $earliestAllowedTimestamp)
->count() > 0;
->where('user_id', $customer->slack_id)
->where('ip', setting('ip.space'))
->filter(fn ($data) => $data['date_last'] >= $earliestAllowedTimestamp)
->count() > 0;

if ($atTheSpace) {
event(new DoorControlUpdated($door->momentaryOpenTime, $door->shouldOpen(true)));
Expand Down
4 changes: 2 additions & 2 deletions app/External/Slack/Modals/SelectAMemberModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

class SelectAMemberModal implements ModalInterface
{
use ModalTrait;
use HasExternalOptions;
use ModalTrait;

private const SELECT_A_MEMBER = 'select-a-member';

Expand Down Expand Up @@ -82,7 +82,7 @@ public static function getExternalOptions(SlackRequest $request): OptionsResult
/** @var Customer $customer */
$name = "{$customer->first_name} {$customer->last_name}";

if(! is_null($filterValue) && ! Str::contains(Str::lower($name), Str::lower($filterValue))) {
if (! is_null($filterValue) && ! Str::contains(Str::lower($name), Str::lower($filterValue))) {
continue;
}

Expand Down
Loading
Loading