feat: Group deck activity settings

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2023-08-22 08:07:03 +02:00
parent af1e413513
commit 8e4c783c97
6 changed files with 103 additions and 10 deletions

View File

@@ -58,9 +58,9 @@
</commands>
<activity>
<settings>
<setting>OCA\Deck\Activity\Setting</setting>
<setting>OCA\Deck\Activity\SettingChanges</setting>
<setting>OCA\Deck\Activity\SettingDescription</setting>
<setting>OCA\Deck\Activity\SettingComment</setting>
<setting>OCA\Deck\Activity\DescriptionSetting</setting>
</settings>
<filters>
<filter>OCA\Deck\Activity\Filter</filter>

View File

@@ -23,9 +23,10 @@
namespace OCA\Deck\Activity;
use OCP\Activity\ActivitySettings;
use OCP\IL10N;
class Setting implements \OCP\Activity\ISetting {
abstract class SettingBase extends ActivitySettings {
/** @var IL10N */
protected $l;
@@ -37,6 +38,14 @@ class Setting implements \OCP\Activity\ISetting {
$this->l = $l;
}
public function getGroupIdentifier() {
return 'deck';
}
public function getGroupName() {
return $this->l->t('Deck');
}
/**
* @return string Lowercase a-z and underscore only identifier
* @since 11.0.0

View File

@@ -0,0 +1,84 @@
<?php
/**
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Deck\Activity;
class SettingChanges extends SettingBase {
/**
* @return string Lowercase a-z and underscore only identifier
* @since 11.0.0
*/
public function getIdentifier(): string {
return 'deck';
}
/**
* @return string A translated string
* @since 11.0.0
*/
public function getName(): string {
return $this->l->t('A <strong>board, list or card</strong> was changed');
}
/**
* @return int whether the filter should be rather on the top or bottom of
* the admin section. The filters are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* @since 11.0.0
*/
public function getPriority(): int {
return 90;
}
/**
* @return bool True when the option can be changed for the stream
* @since 11.0.0
*/
public function canChangeStream(): bool {
return true;
}
/**
* @return bool True when the option can be changed for the stream
* @since 11.0.0
*/
public function isDefaultEnabledStream(): bool {
return true;
}
/**
* @return bool True when the option can be changed for the mail
* @since 11.0.0
*/
public function canChangeMail(): bool {
return true;
}
/**
* @return bool True when the option can be changed for the stream
* @since 11.0.0
*/
public function isDefaultEnabledMail(): bool {
return false;
}
}

View File

@@ -23,7 +23,7 @@
namespace OCA\Deck\Activity;
class SettingComment extends Setting {
class SettingComment extends SettingBase {
/**
* @return string Lowercase a-z and underscore only identifier
@@ -38,7 +38,7 @@ class SettingComment extends Setting {
* @since 11.0.0
*/
public function getName(): string {
return $this->l->t('A <strong>comment</strong> was created on a Deck card');
return $this->l->t('A <strong>comment</strong> was created on a card');
}
/**

View File

@@ -23,7 +23,7 @@
namespace OCA\Deck\Activity;
class DescriptionSetting extends Setting {
class SettingDescription extends SettingBase {
/**
* @return string Lowercase a-z and underscore only identifier
@@ -38,6 +38,6 @@ class DescriptionSetting extends Setting {
* @since 11.0.0
*/
public function getName(): string {
return $this->l->t('A <strong>card description</strong> inside the Deck app has been changed');
return $this->l->t('A <strong>card description</strong> has been changed');
}
}

View File

@@ -30,7 +30,7 @@ class SettingTest extends TestCase {
/** @var IL10N */
private $l10n;
/** @var Setting */
/** @var SettingBase */
private $setting;
public function setUp(): void {
@@ -38,7 +38,7 @@ class SettingTest extends TestCase {
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($s) {
return $s;
}));
$this->setting = new Setting($this->l10n);
$this->setting = new SettingChanges($this->l10n);
}
public function testGetIdentifier() {
@@ -46,7 +46,7 @@ class SettingTest extends TestCase {
}
public function testGetName() {
$this->assertEquals('Changes in the <strong>Deck app</strong>', $this->setting->getName());
$this->assertEquals('A <strong>board, list or card</strong> was changed', $this->setting->getName());
}
public function testGetPriority() {