/** * 記事が編集された時 * * @param EditEvent $event */ public function onItemEdited(EditEvent $event) { $item = $this->itemService->getByOpenItemId($event->getId()); if (!$this->itemShouldNotified($item)) { return; } $user = $this->userService->getById($event->getUserId()); $this->slackUtils->postEditMessage($item, $user); }
/** * 記事が編集された時 * * @param EditEvent $event */ public function onItemEdited(EditEvent $event) { $item = $this->itemService->getByOpenItemId($event->getId()); $recipient = $this->userService->getById($item->user_id); $sender = $this->userService->getById($event->getUserId()); if ($this->userRoleService->isRetire($recipient->id)) { return false; } if ($this->areUsersSame($recipient, $sender)) { return false; } elseif (!$this->notificationIsEnabled('edit', $recipient->id)) { return false; } $this->mail->send('emails.action.edit', $this->getDataForMail($item, $recipient, $sender), function ($m) use($recipient, $sender) { $m->to($recipient->email)->subject('あなたの記事が' . $sender->username . 'さんに編集されました - Owl'); }); }