diff --git a/api/app/Actions/Event/AddEventAction.php b/api/app/Actions/Event/AddEventAction.php index d20dd340d..242e0efb6 100644 --- a/api/app/Actions/Event/AddEventAction.php +++ b/api/app/Actions/Event/AddEventAction.php @@ -37,6 +37,7 @@ public function execute(AddEventRequest $request): UpdateEventResponse $event->invitee_email = $request->getInviteeEmail(); $event->start_date = $request->getStartDate(); $event->timezone = $request->getTimezone(); + $event->invitee_information = $request->getInviteeInformation(); $this->eventRepository->save($event); diff --git a/api/app/Actions/Event/AddEventRequest.php b/api/app/Actions/Event/AddEventRequest.php index 9da5ee312..56881969b 100644 --- a/api/app/Actions/Event/AddEventRequest.php +++ b/api/app/Actions/Event/AddEventRequest.php @@ -12,6 +12,7 @@ final class AddEventRequest private string $startDate; private string $timezone; private ?array $customFieldValues; + private ?string $inviteeInformation; public function __construct( int $eventTypeId, @@ -19,7 +20,8 @@ public function __construct( string $inviteeEmail, string $startDate, string $timezone, - ?array $customFieldValues + ?array $customFieldValues, + ?string $inviteeInformation ) { $this->eventTypeId = $eventTypeId; $this->inviteeName = $inviteeName; @@ -27,6 +29,7 @@ public function __construct( $this->startDate = $startDate; $this->timezone = $timezone; $this->customFieldValues = $customFieldValues; + $this->inviteeInformation = $inviteeInformation; } public function getEventTypeId(): int @@ -58,4 +61,9 @@ public function getCustomFieldValues(): ?array { return $this->customFieldValues; } + + public function getInviteeInformation(): ?string + { + return $this->inviteeInformation; + } } diff --git a/api/app/Actions/SocialAccount/AuthResponse.php b/api/app/Actions/SocialAccount/AuthResponse.php index 3cae5e276..21eb7ad2f 100644 --- a/api/app/Actions/SocialAccount/AuthResponse.php +++ b/api/app/Actions/SocialAccount/AuthResponse.php @@ -6,7 +6,7 @@ class AuthResponse { - private string $urt; + private string $url; private ?array $data; public function __construct(string $url, array $data = []) diff --git a/api/app/Entity/Event.php b/api/app/Entity/Event.php index 128e61e4c..caef5e776 100644 --- a/api/app/Entity/Event.php +++ b/api/app/Entity/Event.php @@ -17,7 +17,8 @@ class Event extends Model 'timezone', 'status', 'location', - 'created_at' + 'created_at', + 'invitee_information' ]; protected $attributes = [ diff --git a/api/app/Exceptions/EventType/CoordinatesFieldIsRequiredException.php b/api/app/Exceptions/EventType/CoordinatesFieldIsRequiredException.php index 78de53f52..e7981b76e 100644 --- a/api/app/Exceptions/EventType/CoordinatesFieldIsRequiredException.php +++ b/api/app/Exceptions/EventType/CoordinatesFieldIsRequiredException.php @@ -9,6 +9,6 @@ final class CoordinatesFieldIsRequiredException extends BaseException { - protected $message = "For 'location_type = address' field 'coordinates' is required!"; + protected $message = "Please, choose address for your meeting"; protected $code = ErrorCode::COORDINATES_FIELD_IS_REQUIRED; } diff --git a/api/app/Http/Controllers/Api/EventController.php b/api/app/Http/Controllers/Api/EventController.php index b0d51d293..22fccf5d4 100644 --- a/api/app/Http/Controllers/Api/EventController.php +++ b/api/app/Http/Controllers/Api/EventController.php @@ -54,7 +54,8 @@ public function store(EventRequest $request): JsonResponse $request->invitee_email, $request->start_date, $request->timezone, - $request->custom_field_values + $request->custom_field_values, + $request->invitee_information ) ); diff --git a/api/app/Jobs/SendNotificationToOwnerChatito.php b/api/app/Jobs/SendNotificationToOwnerChatito.php new file mode 100644 index 000000000..3938e971b --- /dev/null +++ b/api/app/Jobs/SendNotificationToOwnerChatito.php @@ -0,0 +1,36 @@ +event = $event; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + new EventCreatedNotificationToOwnerChatito($this->event); + } +} diff --git a/api/app/Listeners/SendEventCreatedNotificationToOwner.php b/api/app/Listeners/SendEventCreatedNotificationToOwner.php index b60c5cffd..0fbfb117c 100644 --- a/api/app/Listeners/SendEventCreatedNotificationToOwner.php +++ b/api/app/Listeners/SendEventCreatedNotificationToOwner.php @@ -3,9 +3,11 @@ namespace App\Listeners; use App\Events\EventCreated; -use App\Notifications\EventCreatedNotification; +use App\Jobs\SendNotificationToOwnerChatito; +use App\Notifications\EventCreatedNotificationToOwnerChatito; +use App\Notifications\EventCreatedNotificationToOwnerMail; +use App\Notifications\EventCreatedNotificationToOwnerSlack; use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Queue\InteractsWithQueue; class SendEventCreatedNotificationToOwner implements ShouldQueue { @@ -26,6 +28,12 @@ public function __construct() */ public function handle(EventCreated $eventCreated) { - $eventCreated->event->eventType->owner->notify(new EventCreatedNotification($eventCreated->event)); + $eventCreated->event->eventType->owner->notify(new EventCreatedNotificationToOwnerMail($eventCreated->event)); + if ($eventCreated->event->eventType->owner->slack_active) { + $eventCreated->event->eventType->owner->notify(new EventCreatedNotificationToOwnerSlack($eventCreated->event)); + } + if ($eventCreated->event->eventType->owner->chatito_active) { + SendNotificationToOwnerChatito::dispatch($eventCreated->event); + } } } diff --git a/api/app/Mail/EventCreatedMailToInvitee.php b/api/app/Mail/EventCreatedMailToInvitee.php index 408de1389..ebd41731a 100644 --- a/api/app/Mail/EventCreatedMailToInvitee.php +++ b/api/app/Mail/EventCreatedMailToInvitee.php @@ -49,8 +49,7 @@ public function build() 'owner' => $this->owner, 'inviteeName' => $this->inviteeName, 'inviteeEmail' => $this->inviteeEmail, - 'customFieldValues' => $this->event->customFieldValues, - 'location' => $this->event->location + 'customFieldValues' => $this->event->customFieldValues ]); } } diff --git a/api/app/Mail/EventCreatedMailToOwner.php b/api/app/Mail/EventCreatedMailToOwner.php index 92041089f..b507af819 100644 --- a/api/app/Mail/EventCreatedMailToOwner.php +++ b/api/app/Mail/EventCreatedMailToOwner.php @@ -19,11 +19,6 @@ class EventCreatedMailToOwner extends Mailable public EventType $eventType; public User $owner; - /** - * Create a new message instance. - * - * @return void - */ public function __construct(Event $event) { $this->event = $event; @@ -31,11 +26,6 @@ public function __construct(Event $event) $this->owner = $event->eventType->owner; } - /** - * Build the message. - * - * @return $this - */ public function build() { $this->to($this->owner->getEmail()); @@ -47,8 +37,7 @@ public function build() 'event' => $this->event, 'eventType' => $this->eventType, 'user' => $this->owner, - 'customFieldValues' => $this->event->customFieldValues, - 'location' => $this->event->location + 'customFieldValues' => $this->event->customFieldValues ]); } } diff --git a/api/app/Notifications/Chatito/BeforeEventChatitoMessage.php b/api/app/Notifications/Chatito/BeforeEventChatitoMessage.php index 26e4b6887..f0cb1675c 100644 --- a/api/app/Notifications/Chatito/BeforeEventChatitoMessage.php +++ b/api/app/Notifications/Chatito/BeforeEventChatitoMessage.php @@ -25,7 +25,7 @@ protected function generateMessage() "{$this->user->name}

" . "Organizator Email:
" . "{$this->user->email}

" . - "Event Date/Time:
" . + "Event Date/Time (UTC):
" . "{$this->event->start_date}

"; if ($this->event->eventType->location_type == 'zoom') { diff --git a/api/app/Notifications/Chatito/EventCreatedChatitoMessage.php b/api/app/Notifications/Chatito/EventCreatedChatitoMessage.php index ac617c464..005a37871 100644 --- a/api/app/Notifications/Chatito/EventCreatedChatitoMessage.php +++ b/api/app/Notifications/Chatito/EventCreatedChatitoMessage.php @@ -8,7 +8,7 @@ final class EventCreatedChatitoMessage extends ChatitoMessage { protected function generateMessage() { - $message = "Hi, {$this->event->invitee_name} and {$this->user->name}
" . + return "Hi, {$this->event->invitee_name} and {$this->user->name}
" . "A new event was scheduled!

" . "Event Type:
" . "{$this->eventType->name}

" . @@ -22,11 +22,7 @@ protected function generateMessage() "{$this->user->name}

" . "Organizator Email:
" . "{$this->user->email}

" . - "Event Date/Time:
" . + "Event Date/Time (UTC):
" . "{$this->event->start_date}
"; - if ($this->event->location) { - $message .= "Location:
{$this->event->location}
"; - } - return $message; } } diff --git a/api/app/Notifications/EventCreatedNotification.php b/api/app/Notifications/EventCreatedNotification.php deleted file mode 100644 index d18d9a5e8..000000000 --- a/api/app/Notifications/EventCreatedNotification.php +++ /dev/null @@ -1,82 +0,0 @@ -event = $event; - $this->eventType = $event->eventType; - $this->user = $event->eventType->owner; - - if ($this->user->chatito_active) { - $this->toChatito(); - } - } - - /** - * Get the notifications's delivery channels. - * - * @return array - */ - public function via($notifiable) - { - $channels = ['mail']; - if ($this->user->slack_active) { - $channels[] = 'slack'; - } - return $channels; - } - - /** - * Get the mail representation of the notifications. - * - */ - public function toMail($notifiable) - { - return new EventCreatedMailToOwner($this->event); - } - - public function toSlack($notifiable) - { - return new EventCreatedSlackMessage($this->event); - } - - private function toChatito() - { - return new EventCreatedChatitoMessage($this->event); - } - - /** - * Get the array representation of the notifications. - * - * @return array - */ - public function toArray($notifiable) - { - return [ - // - ]; - } -} diff --git a/api/app/Notifications/EventCreatedNotificationToOwnerChatito.php b/api/app/Notifications/EventCreatedNotificationToOwnerChatito.php new file mode 100644 index 000000000..4f52adfa9 --- /dev/null +++ b/api/app/Notifications/EventCreatedNotificationToOwnerChatito.php @@ -0,0 +1,36 @@ +event = $event; + $this->toChatito(); + } + + private function toChatito() + { + return new EventCreatedChatitoMessage($this->event); + } + + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/api/app/Notifications/EventCreatedNotificationToOwnerMail.php b/api/app/Notifications/EventCreatedNotificationToOwnerMail.php new file mode 100644 index 000000000..b5273aecf --- /dev/null +++ b/api/app/Notifications/EventCreatedNotificationToOwnerMail.php @@ -0,0 +1,38 @@ +event = $event; + } + + public function via($notifiable) + { + return ['mail']; + } + + public function toMail($notifiable) + { + return new EventCreatedMailToOwner($this->event); + } + + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/api/app/Notifications/EventCreatedNotificationToOwnerSlack.php b/api/app/Notifications/EventCreatedNotificationToOwnerSlack.php new file mode 100644 index 000000000..322cd4394 --- /dev/null +++ b/api/app/Notifications/EventCreatedNotificationToOwnerSlack.php @@ -0,0 +1,38 @@ +event = $event; + } + + public function via($notifiable) + { + return ['slack']; + } + + public function toSlack($notifiable) + { + return new EventCreatedSlackMessage($this->event); + } + + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/api/app/Notifications/EventTypeDeletedToOwner.php b/api/app/Notifications/EventTypeDeletedToOwner.php index 3897fa9f2..f4334713a 100644 --- a/api/app/Notifications/EventTypeDeletedToOwner.php +++ b/api/app/Notifications/EventTypeDeletedToOwner.php @@ -32,6 +32,7 @@ public function via($notifiable) public function toMail($notifiable) { return (new MailMessage()) + ->subject("EventType was deleted!") ->line(new HtmlString("Hi, {$this->owner->name}!")) ->line(new HtmlString("EventType {$this->eventTypeName} was deleted, so all events was declined!")); } diff --git a/api/resources/views/emails/event_created_to_invitee.blade.php b/api/resources/views/emails/event_created_to_invitee.blade.php index f7c86e752..ce6cb3592 100644 --- a/api/resources/views/emails/event_created_to_invitee.blade.php +++ b/api/resources/views/emails/event_created_to_invitee.blade.php @@ -18,14 +18,9 @@ Invitee Email (You):
{{ $inviteeEmail }} -Event Date/Time:
+Event Date/Time (UTC):
{{ $event->start_date }} -@if($location) -Location:
-{{ $location }} -@endif - @if(count($customFieldValues)) Questions:
@foreach($customFieldValues as $customFieldValue) diff --git a/api/resources/views/notifications/event_created.blade.php b/api/resources/views/notifications/event_created.blade.php index 247247519..00dd8893d 100644 --- a/api/resources/views/notifications/event_created.blade.php +++ b/api/resources/views/notifications/event_created.blade.php @@ -12,16 +12,11 @@ Invitee Email:
{{ $event->invitee_email }} -Event Date/Time:
-{{ $event->start_date }} - Invitee TimeZone:
{{ $event->timezone }} -@if($location) -Location:
-{{ $location }} -@endif +Event Date/Time (UTC):
+{{ $event->start_date }} @if(count($customFieldValues)) Questions:
diff --git a/client/src/components/public/users-event-types/UserEventType.vue b/client/src/components/public/users-event-types/UserEventType.vue index 34a70cc6a..64e435d10 100644 --- a/client/src/components/public/users-event-types/UserEventType.vue +++ b/client/src/components/public/users-event-types/UserEventType.vue @@ -43,7 +43,8 @@ export default { } .event-type-name, .description { - word-break: break-all; + white-space: pre-wrap; + word-break: break-word; } .description { text-overflow: ellipsis; diff --git a/client/src/store/modules/scheduledEvent/normalizer.js b/client/src/store/modules/scheduledEvent/normalizer.js index be5127531..dddfaf9f5 100644 --- a/client/src/store/modules/scheduledEvent/normalizer.js +++ b/client/src/store/modules/scheduledEvent/normalizer.js @@ -37,6 +37,5 @@ export const eventApiMapper = Event => ({ .tz(Event.timezone) .utc() .format('YYYY-MM-DD HH:mm:ss'), - timezone: Event.timezone, - event_type: eventTypeMapper(Event.eventType) + timezone: Event.timezone });