diff --git a/lib/Controller/FeedController.php b/lib/Controller/FeedController.php
index d3a3b6065..392b241d3 100644
--- a/lib/Controller/FeedController.php
+++ b/lib/Controller/FeedController.php
@@ -25,6 +25,7 @@
use OCA\Activity\Data;
use OCA\Activity\GroupHelper;
use OCA\Activity\UserSettings;
+use OCA\Theming\ThemingDefaults;
use OCP\Activity\IManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
@@ -48,7 +49,9 @@ public function __construct(
protected IURLGenerator $urlGenerator,
protected IManager $activityManager,
protected IFactory $l10nFactory,
- protected IConfig $config) {
+ protected IConfig $config,
+ protected ThemingDefaults $themingDefaults,
+ ) {
parent::__construct($appName, $request);
}
@@ -85,11 +88,13 @@ public function show() {
];
}
+ $title = $this->themingDefaults->getTitle();
$response = new TemplateResponse('activity', 'rss', [
'rssLang' => $this->l->getLanguageCode(),
'rssLink' => $this->urlGenerator->linkToRouteAbsolute('activity.Feed.show'),
'rssPubDate' => date('r'),
'description' => $description,
+ 'title' => $title !== '' ? $this->l->t('Activity feed for %1$s', [$title]) : $this->l->t('Activity feed'),
'activities' => $activities,
], '');
diff --git a/psalm.xml b/psalm.xml
index 9471406de..67091bc4c 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -50,5 +50,6 @@
+
diff --git a/templates/rss.php b/templates/rss.php
index cf8597b1e..8a9dae5dd 100644
--- a/templates/rss.php
+++ b/templates/rss.php
@@ -25,7 +25,7 @@
- t('Activity feed')); ?>
+
diff --git a/tests/Controller/FeedControllerTest.php b/tests/Controller/FeedControllerTest.php
index abbc9f19e..0a1a31e5c 100644
--- a/tests/Controller/FeedControllerTest.php
+++ b/tests/Controller/FeedControllerTest.php
@@ -29,6 +29,7 @@
use OCA\Activity\GroupHelper;
use OCA\Activity\Tests\TestCase;
use OCA\Activity\UserSettings;
+use OCA\Theming\ThemingDefaults;
use OCP\Activity\IManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
@@ -64,6 +65,9 @@ class FeedControllerTest extends TestCase {
/** @var \OCP\IL10N */
protected $l10n;
+ /** @var ThemingDefaults|MockObject */
+ protected $themingDefault;
+
/** @var FeedController */
protected $controller;
@@ -78,6 +82,7 @@ protected function setUp(): void {
$this->request = $this->createMock(IRequest::class);
$this->session = $this->createMock(IUserSession::class);
$this->manager = $this->createMock(IManager::class);
+ $this->themingDefault = $this->createMock(ThemingDefaults::class);
/** @var $urlGenerator IURLGenerator|MockObject */
$urlGenerator = $this->createMock(IURLGenerator::class);
@@ -91,7 +96,8 @@ protected function setUp(): void {
$urlGenerator,
$this->manager,
\OC::$server->getL10NFactory(),
- $this->config
+ $this->config,
+ $this->themingDefault,
);
}
diff --git a/tests/Template/RssTest.php b/tests/Template/RssTest.php
index cbd88a39c..cd2282fca 100644
--- a/tests/Template/RssTest.php
+++ b/tests/Template/RssTest.php
@@ -30,8 +30,8 @@
class RssTest extends TestCase {
public function dataEmpty(): array {
return [
- ['de', 'http://localhost', 'description', 'Fri, 28 Aug 2015 11:47:14 +0000'],
- ['en', 'http://nextcloud.org', 'Desc', 'Fri, 28 Aug 2015 11:47:15 +0000'],
+ ['de', 'http://localhost', 'title', 'description', 'Fri, 28 Aug 2015 11:47:14 +0000'],
+ ['en', 'http://nextcloud.org', 'The title', 'Desc', 'Fri, 28 Aug 2015 11:47:15 +0000'],
];
}
@@ -43,12 +43,13 @@ public function dataEmpty(): array {
* @param string $description
* @param string $timeDate
*/
- public function testEmpty(string $language, string $link, string $description, string $timeDate): void {
+ public function testEmpty(string $language, string $link, string $title, string $description, string $timeDate): void {
$template = new TemplateResponse('activity', 'rss', [
'rssLang' => $language,
'rssLink' => $link,
'rssPubDate' => $timeDate,
'description' => $description,
+ 'title' => $title,
'activities' => [],
], '');
@@ -56,7 +57,7 @@ public function testEmpty(string $language, string $link, string $description, s
''
. "\n" . ''
. "\n" . ' '
- . "\n" . ' Activity feed'
+ . "\n" . ' ' . $title . ''
. "\n" . ' ' . $language . ''
. "\n" . ' ' . $link . ''
. "\n" . ' ' . $description . ''
@@ -118,6 +119,7 @@ public function testContent(array $activities, string $expected): void {
'rssLink' => 'http://nextcloud.org',
'rssPubDate' => 'Fri, 28 Aug 2015 11:47:15 +0000',
'description' => 'Desc',
+ 'title' => 'Activity feed',
'activities' => $activities,
], '');
$rendered = $template->render();
diff --git a/tests/stubs/oca_theming_defaults.php b/tests/stubs/oca_theming_defaults.php
new file mode 100644
index 000000000..d7c034aa7
--- /dev/null
+++ b/tests/stubs/oca_theming_defaults.php
@@ -0,0 +1,21 @@
+