Skip to content

Commit

Permalink
Allow to hide People nav entry for admin
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
artonge committed Jan 4, 2024
1 parent 229fac4 commit c24e36d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/Controller/PageController.php
Expand Up @@ -48,6 +48,7 @@
use OCP\Files\Search\ISearchComparison;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IUserSession;
Expand Down Expand Up @@ -76,6 +77,7 @@ public function __construct(
IRootFolder $rootFolder,
ICacheFactory $cacheFactory,
LoggerInterface $logger,
private IConfig $config,
IL10N $l10n
) {
parent::__construct(Application::APP_ID, $request);
Expand Down Expand Up @@ -110,6 +112,7 @@ public function index(): TemplateResponse {
$this->initialState->provideInitialState('maps', $this->appManager->isEnabledForUser('maps') === true);
$this->initialState->provideInitialState('recognize', $this->appManager->isEnabledForUser('recognize') === true);
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
$this->initialState->provideInitialState('showPeopleMenuEntry', $this->config->getAppValue('photos', 'showPeopleMenuEntry', 'true') === 'true');

// Provide user config
foreach (array_keys(UserConfigService::DEFAULT_CONFIGS) as $key) {
Expand Down
2 changes: 1 addition & 1 deletion src/Photos.vue
Expand Up @@ -196,7 +196,7 @@ export default {
: getCurrentUser().isAdmin || isMapsInstalled,
showPeopleMenuEntry: getCurrentUser() === null
? false
: getCurrentUser().isAdmin || isRecognizeInstalled,
: (getCurrentUser().isAdmin && loadState('photos', 'showPeopleMenuEntry', true)) || isRecognizeInstalled,
openedSettings: false,
}
Expand Down

0 comments on commit c24e36d

Please sign in to comment.