Skip to content

Commit fb21a06

Browse files
committed
Hide user data manifesto and mission with valid subscription
Signed-off-by: Joas Schilling <[email protected]>
1 parent f2c628b commit fb21a06

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

lib/Settings/MissionSettings.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* Privacy App
46
*
@@ -23,32 +25,30 @@
2325

2426
use OCP\AppFramework\Http\TemplateResponse;
2527
use OCP\Settings\ISettings;
28+
use OCP\Support\Subscription\IRegistry;
2629

27-
/**
28-
* Class MissionSettings
29-
*
30-
* @package OCA\Privacy\Settings
31-
*/
3230
class MissionSettings implements ISettings {
3331

34-
/**
35-
* @return TemplateResponse
36-
*/
37-
public function getForm():TemplateResponse {
32+
/** @var IRegistry */
33+
protected $subscription;
34+
35+
public function __construct(IRegistry $subscription) {
36+
$this->subscription = $subscription;
37+
}
38+
39+
public function getForm(): TemplateResponse {
3840
return new TemplateResponse('privacy', 'mission');
3941
}
4042

41-
/**
42-
* @return string
43-
*/
44-
public function getSection():string {
43+
public function getSection(): ?string {
44+
if ($this->subscription->delegateHasValidSubscription()) {
45+
return null;
46+
}
47+
4548
return 'privacy';
4649
}
4750

48-
/**
49-
* @return int
50-
*/
51-
public function getPriority():int {
51+
public function getPriority(): int {
5252
return 0;
5353
}
5454
}
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* Privacy App
46
*
@@ -23,32 +25,30 @@
2325

2426
use OCP\AppFramework\Http\TemplateResponse;
2527
use OCP\Settings\ISettings;
28+
use OCP\Support\Subscription\IRegistry;
2629

27-
/**
28-
* Class UserDataManifestoSettings
29-
*
30-
* @package OCA\Privacy\Settings
31-
*/
3230
class UserDataManifestoSettings implements ISettings {
3331

34-
/**
35-
* @return TemplateResponse
36-
*/
37-
public function getForm():TemplateResponse {
32+
/** @var IRegistry */
33+
protected $subscription;
34+
35+
public function __construct(IRegistry $subscription) {
36+
$this->subscription = $subscription;
37+
}
38+
39+
public function getForm(): TemplateResponse {
3840
return new TemplateResponse('privacy', 'user-data-manifesto');
3941
}
4042

41-
/**
42-
* @return string
43-
*/
44-
public function getSection():string {
43+
public function getSection(): ?string {
44+
if ($this->subscription->delegateHasValidSubscription()) {
45+
return null;
46+
}
47+
4548
return 'privacy';
4649
}
4750

48-
/**
49-
* @return int
50-
*/
51-
public function getPriority():int {
51+
public function getPriority(): int {
5252
return 5;
5353
}
5454
}

0 commit comments

Comments
 (0)