24 $eventType = $this->
event->getType();
27 case EventDictionary::EVENT_WORKGROUP_USER_ADD:
30 case EventDictionary::EVENT_WORKGROUP_USER_UPDATE:
31 $this->onUserUpdate();
33 case EventDictionary::EVENT_WORKGROUP_USER_DELETE:
34 $this->onUserDelete();
41 private function onUserAdd(): void
43 $eventData = $this->
event->getData();
44 $groupId = $eventData[
'GROUP_ID'] ??
null;
45 $userId = $eventData[
'USER_ID'] ??
null;
46 $role = $eventData[
'ROLE'] ??
null;
47 $initiatedByType = $eventData[
'INITIATED_BY_TYPE'] ??
null;
55 private function onUserUpdate(): void
57 $eventData = $this->
event->getData();
58 $groupId = $eventData[
'GROUP_ID'] ??
null;
59 $userId = $eventData[
'USER_ID'] ??
null;
60 $oldRole = $eventData[
'OLD_ROLE'] ??
null;
61 $oldInitiatedByType = $eventData[
'OLD_INITIATED_BY_TYPE'] ??
null;
62 $newRole = $eventData[
'NEW_ROLE'] ??
null;
67 if ($wasRequest && $wasUserRequest && $isMember)
69 $this->setStubActivity($groupId,
$userId);
73 private function onUserDelete(): void
75 $eventData = $this->
event->getData();
76 $groupId = $eventData[
'GROUP_ID'] ??
null;
77 $userId = $eventData[
'USER_ID'] ??
null;
78 $initiatedByType = $eventData[
'INITIATED_BY_TYPE'] ??
null;
79 $role = $eventData[
'ROLE'] ??
null;
83 if ($wasRequest && $wasUserRequest)
85 $this->setStubActivity($groupId,
$userId);
89 private function setStubActivity(
int $spaceId,
int $entityId): void
91 $recentActivityData = $this->activityService->get($this->recipient->getId(), $spaceId);
94 $recentActivityData->getTypeId() !== $this->getTypeId()
95 || $recentActivityData->getEntityId() !==
$entityId
101 $recentActivityData->setTypeId(
'stub');
102 $recentActivityData->setEntityId(0);
104 $this->activityService->save($recentActivityData);