16 if (!$this->hasAccess())
20 return new EventResult(EventResult::ERROR,
null,
null, $this);
26 private function hasAccess(): bool
28 foreach ($this->
getAction()->getArguments() as $argument)
30 if ($argument instanceof
Message)
32 return $argument->getChat()->hasAccess();
36 return $this->hasAccessToMessages($argument);
38 if ($argument instanceof
Chat)
40 return $argument->hasAccess();
47 private function hasAccessToMessages(MessageCollection $messages): bool
49 $commonChatId = $messages->getCommonChatId();
51 if ($commonChatId !==
null)
56 foreach ($messages as $message)
58 if (!$message->getChat()->hasAccess())