Skip to content

Commit

Permalink
chore!: Remove navigation in favor of external sites app
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Jul 15, 2024
1 parent ddf2eee commit 9aeaee1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
31 changes: 0 additions & 31 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace OCA\Gitlab\AppInfo;

use Closure;
use OCA\Gitlab\Dashboard\GitlabWidget;
use OCA\Gitlab\Listener\GitlabReferenceListener;
use OCA\Gitlab\Reference\GitlabReferenceProvider;
Expand All @@ -24,10 +23,6 @@
use OCP\Collaboration\Reference\RenderReferenceEvent;
use OCP\IConfig;

use OCP\IL10N;
use OCP\INavigationManager;
use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Util;

class Application extends App implements IBootstrap {
Expand All @@ -54,32 +49,6 @@ public function register(IRegistrationContext $context): void {
}

public function boot(IBootContext $context): void {
$context->injectFn(Closure::fromCallable([$this, 'registerNavigation']));
Util::addStyle(self::APP_ID, 'gitlab-search');
}

public function registerNavigation(IUserSession $userSession): void {
$user = $userSession->getUser();
if ($user !== null) {
$userId = $user->getUID();
$container = $this->getContainer();

if ($this->config->getUserValue($userId, self::APP_ID, 'navigation_enabled', '0') === '1') {
$adminOauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url', self::DEFAULT_GITLAB_URL) ?: self::DEFAULT_GITLAB_URL;
$gitlabUrl = $this->config->getUserValue($userId, self::APP_ID, 'url', $adminOauthUrl) ?: $adminOauthUrl;
$container->get(INavigationManager::class)->add(function () use ($container, $gitlabUrl) {
$urlGenerator = $container->get(IURLGenerator::class);
$l10n = $container->get(IL10N::class);
return [
'id' => self::APP_ID,
'order' => 10,
'href' => $gitlabUrl,
'target' => '_blank',
'icon' => $urlGenerator->imagePath(self::APP_ID, 'app.svg'),
'name' => $l10n->t('GitLab'),
];
});
}
}
}
}
2 changes: 0 additions & 2 deletions lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function getForm(): TemplateResponse {
$searchEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'search_enabled', '0') === '1';
$searchIssuesEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'search_issues_enabled', '0') === '1';
$searchMRsEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'search_mrs_enabled', '0') === '1';
$navigationEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'navigation_enabled', '0') === '1';
$linkPreviewEnabled = $this->config->getUserValue($this->userId, Application::APP_ID, 'link_preview_enabled', '1') === '1';

$userName = $this->config->getUserValue($this->userId, Application::APP_ID, 'user_name');
Expand All @@ -51,7 +50,6 @@ public function getForm(): TemplateResponse {
'search_enabled' => $searchEnabled,
'search_issues_enabled' => $searchIssuesEnabled,
'search_mrs_enabled' => $searchMRsEnabled,
'navigation_enabled' => $navigationEnabled ,
'link_preview_enabled' => $linkPreviewEnabled,
];
$this->initialStateService->provideInitialState('user-config', $userConfig);
Expand Down
6 changes: 1 addition & 5 deletions src/components/PersonalSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@
{{ t('integration_gitlab', 'Warning, everything you type in the search bar will be sent to GitLab.') }}
</p>
</div>
<NcCheckboxRadioSwitch
:checked="state.navigation_enabled"
@update:checked="onCheckboxChanged($event, 'navigation_enabled')">
{{ t('integration_gitlab', 'Enable navigation link') }}
</NcCheckboxRadioSwitch>
<p>{{ t('integration_gitlab', 'Please use the External Sites app to add GitLab to your navigation bar:') }} <a href="https://apps.nextcloud.com/apps/external" target="_blank" rel="noopener">https://apps.nextcloud.com/apps/external</a></p>
<NcCheckboxRadioSwitch
:checked="state.link_preview_enabled"
@update:checked="onCheckboxChanged($event, 'link_preview_enabled')">
Expand Down

0 comments on commit 9aeaee1

Please sign in to comment.