diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
index 38ca08d1f..fe515918a 100644
--- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
+++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
@@ -72,6 +72,7 @@ class ActivityController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$view = null;
+ // TODO: add pagination
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -80,10 +81,9 @@ class ActivityController extends AbstractController
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
$person->getCenter());
- $activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
- ['person' => $person, 'scope' => $reachableScopes],
- ['date' => 'DESC'],
- );
+ $activities = $em->getRepository(Activity::class)
+ ->findByPersonImplied($person, $reachableScopes)
+ ;
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
index 3ad204f18..8c8fb45a9 100644
--- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php
+++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
@@ -224,7 +224,8 @@ class ActivityType extends AbstractType
if ($activityType->isVisible('comment')) {
$builder->add('comment', CommentType::class, [
- 'label' => $activityType->getLabel('comment'),
+ 'label' => empty($activityType->getLabel('comment'))
+ ? 'activity.comment' : $activityType->getLabel('comment'),
'required' => $activityType->isRequired('comment'),
]);
}
diff --git a/src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php
deleted file mode 100644
index f11aa28bc..000000000
--- a/src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php
+++ /dev/null
@@ -1,88 +0,0 @@
-
- */
-class MenuBuilder implements LocalMenuBuilderInterface
-{
- /**
- *
- * @var TokenStorageInterface
- */
- protected $tokenStorage;
-
- /**
- *
- * @var TranslatorInterface
- */
- protected $translator;
-
- /**
- *
- * @var AuthorizationHelper
- */
- protected $authorizationHelper;
-
- public function __construct(
- TokenStorageInterface $tokenStorage,
- TranslatorInterface $translator,
- AuthorizationHelper $authorizationHelper
- ) {
- $this->tokenStorage = $tokenStorage;
- $this->translator = $translator;
- $this->authorizationHelper = $authorizationHelper;
- }
-
-
- public function buildMenu($menuId, MenuItem $menu, array $parameters)
- {
- /* @var $person \Chill\PersonBundle\Entity\Person */
- $person = $parameters['person'];
- $user = $this->tokenStorage->getToken()->getUser();
- $roleSee = new Role(ActivityVoter::SEE);
- $roleAdd = new Role(ActivityVoter::CREATE);
-
- if ($this->authorizationHelper->userHasAccess($user, $person, $roleSee)) {
- $menu->addChild($this->translator->trans('Activity list'), [
- 'route' => 'chill_activity_activity_list',
- 'routeParameters' => [
- 'person_id' => $person->getId()
- ]
- ])
- ->setExtras([
- 'order' => 201
- ]);
- }
-
- if ($this->authorizationHelper->userHasAccess($user, $person, $roleAdd)) {
- $menu->addChild($this->translator->trans('Add a new activity'), [
- 'route' => 'chill_activity_activity_new',
- 'routeParameters' => [
- 'person_id' => $person->getId()
- ]
- ])
- ->setExtras([
- 'order' => 200
- ]);
- }
- }
-
- public static function getMenuIds(): array
- {
- return [ 'person' ];
- }
-}
diff --git a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php
index 7c8092227..e44a0f561 100644
--- a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php
+++ b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php
@@ -15,8 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see