Add CommentEmbeddable to Activity : remoke remark field (Ref #21)

This commit is contained in:
Jean-Francois Monfort
2021-03-11 14:27:46 +01:00
parent cde3c900df
commit f35cb679b7
14 changed files with 240 additions and 210 deletions

View File

@@ -41,22 +41,22 @@ use Chill\ActivityBundle\Form\ActivityType;
*/
class ActivityController extends AbstractController
{
/**
* @var EventDispatcherInterface
*/
protected $eventDispatcher;
/**
* @var AuthorizationHelper
*/
protected $authorizationHelper;
/**
* @var LoggerInterface
*/
protected $logger;
/**
* ActivityController constructor.
*
@@ -72,7 +72,7 @@ class ActivityController extends AbstractController
$this->authorizationHelper = $authorizationHelper;
$this->logger = $logger;
}
/**
* Lists all Activity entities.
*
@@ -97,13 +97,13 @@ class ActivityController extends AbstractController
array('person' => $person, 'scope' => $reachableScopes),
array('date' => 'DESC')
);
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
'action' => 'list'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render('ChillActivityBundle:Activity:list.html.twig', array(
'activities' => $activities,
'person' => $person
@@ -241,14 +241,14 @@ class ActivityController extends AbstractController
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
$deleteForm = $this->createDeleteForm($id, $person);
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
'element_id' => $entity->getId(),
'action' => 'show'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
'person' => $person,
'entity' => $entity,
@@ -281,7 +281,7 @@ class ActivityController extends AbstractController
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id, $person);
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
'element_id' => $entity->getId(),
@@ -339,7 +339,7 @@ class ActivityController extends AbstractController
$deleteForm = $this->createDeleteForm($id, $person);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
'element_id' => $entity->getId(),
@@ -356,7 +356,7 @@ class ActivityController extends AbstractController
$this->get('translator')
->trans('Success : activity updated!')
);
return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $id, 'person_id' => $person_id)));
}
@@ -400,12 +400,12 @@ class ActivityController extends AbstractController
$form->handleRequest($request);
if ($form->isValid()) {
$this->logger->notice("An activity has been removed", array(
'by_user' => $this->getUser()->getUsername(),
'activity_id' => $activity->getId(),
'person_id' => $activity->getPerson()->getId(),
'remark' => $activity->getRemark(),
'comment' => $activity->getComment()->getComment(),
'scope_id' => $activity->getScope()->getId(),
'reasons_ids' => $activity->getReasons()
->map(function ($ar) { return $ar->getId(); })