apps/dav/lib/CalDAV/Activity/Backend.php
/**
	 * Creates activities for all related users when a calendar was touched
	 *
	 * @param string $action
	 * @param array $calendarData
	 * @param array $shares
	 * @param array $changedProperties
	 */
Creates activities for all related users when a calendar was touched
@param string $action
@param array $calendarData
@param array $shares
@param array $changedProperties
Creates activities for all related users when a calendar was touched @param string $action @param array $calendarData @param array $shares @param array $changedProperties
protected function triggerCalendarActivity($action, array $calendarData, array $shares = [], array $changedProperties = []) {
		if (!isset($calendarData['principaluri'])) {
			return;
		}
		$principal = explode('/', $calendarData['principaluri']);
		$owner = array_pop($principal);
		$currentUser = $this->userSession->getUser();
		if ($currentUser instanceof IUser) {
			$currentUser = $currentUser->getUID();
		} else {
			$currentUser = $owner;
		}
		$event = $this->activityManager->generateEvent();
		$event->setApp('dav')
			->setObject('calendar', (int) $calendarData['id'])
			->setType('calendar')
			->setAuthor($currentUser);
		$changedVisibleInformation = array_intersect([
			'{DAV:}displayname',
			'{http://apple.com/ns/ical/}calendar-color'
		], array_keys($changedProperties));
		if (empty($shares) || ($action === Calendar::SUBJECT_UPDATE && empty($changedVisibleInformation))) {
			$users = [$owner];
		} else {
			$users = $this->getUsersForShares($shares);
			$users[] = $owner;
		}
		foreach ($users as $user) {
			$event->setAffectedUser($user)
				->setSubject(
					$user === $currentUser ? $action . '_self' : $action,
					[
						$currentUser,
						$calendarData['{DAV:}displayname'],
					]
				);
			$this->activityManager->publish($event);
		}
	}
protected function triggerCalendarActivity ( $ action , array $ calendarData , array $ shares = [ ] , array $ changedProperties = [ ] ) { if ( ! isset ( $ calendarData [ 'principaluri' ] ) ) { return ; } $ principal = explode ( '/' , $ calendarData [ 'principaluri' ] ) ; $ owner = array_pop ( $ principal ) ; $ currentUser = $ this -> userSession -> getUser ( ) ; if ( $ currentUser instanceof IUser ) { $ currentUser = $ currentUser -> getUID ( ) ; } else { $ currentUser = $ owner ; } $ event = $ this -> activityManager -> generateEvent ( ) ; $ event -> setApp ( 'dav' ) -> setObject ( 'calendar' , ( int ) $ calendarData [ 'id' ] ) -> setType ( 'calendar' ) -> setAuthor ( $ currentUser ) ; $ changedVisibleInformation = array_intersect ( [ '{DAV:}displayname' , '{http://apple.com/ns/ical/}calendar-color' ] , array_keys ( $ changedProperties ) ) ; if ( empty ( $ shares ) || ( $ action === Calendar :: SUBJECT_UPDATE && empty ( $ changedVisibleInformation ) ) ) { $ users = [ $ owner ] ; } else { $ users = $ this -> getUsersForShares ( $ shares ) ; $ users [ ] = $ owner ; } foreach ( $ users as $ user ) { $ event -> setAffectedUser ( $ user ) -> setSubject ( $ user === $ currentUser ? $ action . '_self' : $ action , [ $ currentUser , $ calendarData [ '{DAV:}displayname' ] , ] ) ; $ this -> activityManager -> publish ( $ event ) ; } }
Creates activities for all related users when a calendar was touched
 @param string $action
 @param array $calendarData
 @param array $shares
 @param array $changedProperties
Creates activities for all related users when a calendar was touched @param string $action @param array $calendarData @param array $shares @param array $changedProperties