| @@ -2,8 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace FluentBooking\App\Services; |
| 4 | 4 | |
| 5 | 5 | use FluentBooking\App\Models\Calendar; |
| 6 | +use FluentBooking\Framework\Support\Arr; | |
| 6 | 7 | |
| 7 | 8 | class CalendarEventService |
| 8 | 9 | { |
| 9 | 10 | public static function processEvent($calendarEvent) |
| @@ -15,10 +16,8 @@ | ||
| 15 | 16 | $calendarEvent->durations = $calendarEvent->getAvailableDurations(); |
| 16 | 17 | |
| 17 | 18 | $calendarEvent->description = $calendarEvent->getDescription(); |
| 18 | 19 | |
| 19 | - $calendarEvent->short_description = Helper::excerpt($calendarEvent->description); | |
| 20 | - | |
| 21 | 20 | $calendarEvent->locations = $calendarEvent->defaultLocationHtml(); |
| 22 | 21 | |
| 23 | 22 | do_action_ref_array('fluent_booking/processed_event', [&$calendarEvent]); |
| 24 | 23 | |
| @@ -39,6 +38,19 @@ | ||
| 39 | 38 | $calendarEvent = self::processEvent($calendarEvent); |
| 40 | 39 | } |
| 41 | 40 | |
| 42 | 41 | return $calendarEvents; |
| 42 | + } | |
| 43 | + | |
| 44 | + public static function isSharedCalendarEvent($calendarEvent) | |
| 45 | + { | |
| 46 | + $userId = get_current_user_id(); | |
| 47 | + | |
| 48 | + if ($calendarEvent->user_id == $userId) { | |
| 49 | + return true; | |
| 50 | + } | |
| 51 | + | |
| 52 | + $teamMembers = Arr::get($calendarEvent, 'settings.team_members', []); | |
| 53 | + | |
| 54 | + return in_array($userId, $teamMembers); | |
| 43 | 55 | } |
| 44 | 56 | } |