diff --git a/js/script.js b/js/script.js index 7d86a9d45..e129273b6 100755 --- a/js/script.js +++ b/js/script.js @@ -59,7 +59,7 @@ $(function(){ var navigationLink = this.$navigation.find('a[data-navigation=' + filter + ']'); navigationLink.parent().addClass('active').attr('aria-current', 'page'); window.document.title = navigationLink.text().trim() + ' - ' + this.defaultPageTitle; - + OCP.Accessibility.setPageHeading(navigationLink.text().trim()); OCA.Activity.InfinitScrolling.prefill(); } }; diff --git a/lib/Controller/ActivitiesController.php b/lib/Controller/ActivitiesController.php index 388bc0487..7877f1636 100644 --- a/lib/Controller/ActivitiesController.php +++ b/lib/Controller/ActivitiesController.php @@ -27,6 +27,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; +use OCP\IL10N; use OCP\IRequest; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; @@ -38,6 +39,9 @@ class ActivitiesController extends Controller { /** @var Data */ protected $data; + /** @var IL10N */ + private $l10n; + /** @var Navigation */ protected $navigation; @@ -51,18 +55,21 @@ class ActivitiesController extends Controller { * @param Data $data * @param Navigation $navigation * @param EventDispatcherInterface $eventDispatcher + * @param IL10N $l10n */ public function __construct($appName, IRequest $request, IConfig $config, Data $data, Navigation $navigation, - EventDispatcherInterface $eventDispatcher) { + EventDispatcherInterface $eventDispatcher, + IL10N $l10n) { parent::__construct($appName, $request); $this->data = $data; $this->config = $config; $this->navigation = $navigation; $this->eventDispatcher = $eventDispatcher; + $this->l10n = $l10n; } /** @@ -82,6 +89,7 @@ public function showList($filter = 'all') { 'appNavigation' => $this->navigation->getTemplate($filter), 'avatars' => $this->config->getSystemValue('enable_avatars', true) ? 'yes' : 'no', 'filter' => $filter, + 'pageTitle' => $this->l10n->t('Activity') ]); } } diff --git a/tests/Controller/ActivitiesControllerTest.php b/tests/Controller/ActivitiesControllerTest.php index 2f53f54ab..586559881 100644 --- a/tests/Controller/ActivitiesControllerTest.php +++ b/tests/Controller/ActivitiesControllerTest.php @@ -24,6 +24,7 @@ use OCA\Activity\Controller\ActivitiesController; use OCA\Activity\Tests\TestCase; +use OCP\IL10N; use OCP\ILogger; use OCP\Template; use PHPUnit\Framework\MockObject\MockObject; @@ -51,6 +52,8 @@ class ActivitiesControllerTest extends TestCase { protected $eventDispatcher; /** @var Navigation|MockObject */ protected $navigation; + /** @var IL10N */ + protected $l10n; /** @var ActivitiesController */ protected $controller; @@ -63,6 +66,7 @@ protected function setUp(): void { $this->navigation = $this->createMock(Navigation::class); $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class); $this->request = $this->createMock(IRequest::class); + $this->l10n = $this->createMock(IL10N::class); $this->controller = $this->getController(); } @@ -75,7 +79,8 @@ protected function getController(array $methods = []): ActivitiesController { $this->config, $this->data, $this->navigation, - $this->eventDispatcher + $this->eventDispatcher, + $this->l10n, ); } @@ -87,6 +92,7 @@ protected function getController(array $methods = []): ActivitiesController { $this->data, $this->navigation, $this->eventDispatcher, + $this->l10n, ]) ->onlyMethods($methods) ->getMock();