diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 6e4ae2dfde..d58f6f073e 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -21,9 +21,7 @@
use OCA\Mail\Contracts\ITrustedSenderService;
use OCA\Mail\Contracts\IUserPreferences;
use OCA\Mail\Dashboard\ImportantMailWidget;
-use OCA\Mail\Dashboard\ImportantMailWidgetV2;
use OCA\Mail\Dashboard\UnreadMailWidget;
-use OCA\Mail\Dashboard\UnreadMailWidgetV2;
use OCA\Mail\Events\BeforeImapClientCreated;
use OCA\Mail\Events\DraftMessageCreatedEvent;
use OCA\Mail\Events\DraftSavedEvent;
@@ -70,7 +68,6 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
-use OCP\Dashboard\IAPIWidgetV2;
use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\IServerContainer;
use OCP\Search\IFilteringProvider;
@@ -150,13 +147,8 @@ public function register(IRegistrationContext $context): void {
$context->registerMiddleWare(ErrorMiddleware::class);
$context->registerMiddleWare(ProvisioningMiddleware::class);
- if (interface_exists(IAPIWidgetV2::class)) {
- $context->registerDashboardWidget(ImportantMailWidgetV2::class);
- $context->registerDashboardWidget(UnreadMailWidgetV2::class);
- } else {
- $context->registerDashboardWidget(ImportantMailWidget::class);
- $context->registerDashboardWidget(UnreadMailWidget::class);
- }
+ $context->registerDashboardWidget(ImportantMailWidget::class);
+ $context->registerDashboardWidget(UnreadMailWidget::class);
if (interface_exists(IFilteringProvider::class)) {
$context->registerSearchProvider(FilteringProvider::class);
diff --git a/lib/Dashboard/ImportantMailWidgetV2.php b/lib/Dashboard/ImportantMailWidgetV2.php
deleted file mode 100644
index 86584b6f97..0000000000
--- a/lib/Dashboard/ImportantMailWidgetV2.php
+++ /dev/null
@@ -1,36 +0,0 @@
-= 27.1.0
- */
-class ImportantMailWidgetV2 extends MailWidgetV2 {
- /**
- * @inheritDoc
- */
- public function getId(): string {
- return 'mail';
- }
-
- /**
- * @inheritDoc
- */
- public function getTitle(): string {
- return $this->l10n->t('Important mail');
- }
-
- /**
- * @inheritDoc
- */
- public function getSearchFilter(): string {
- return 'is:important';
- }
-}
diff --git a/lib/Dashboard/MailWidget.php b/lib/Dashboard/MailWidget.php
index d13111b69c..ea04fa67f9 100644
--- a/lib/Dashboard/MailWidget.php
+++ b/lib/Dashboard/MailWidget.php
@@ -17,16 +17,19 @@
use OCA\Mail\Service\AccountService;
use OCP\AppFramework\Services\IInitialState;
use OCP\Dashboard\IAPIWidget;
+use OCP\Dashboard\IAPIWidgetV2;
+use OCP\Dashboard\IButtonWidget;
use OCP\Dashboard\IIconWidget;
use OCP\Dashboard\IOptionWidget;
+use OCP\Dashboard\Model\WidgetButton;
use OCP\Dashboard\Model\WidgetItem;
+use OCP\Dashboard\Model\WidgetItems;
use OCP\Dashboard\Model\WidgetOptions;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserManager;
-use OCP\Util;
-abstract class MailWidget implements IAPIWidget, IIconWidget, IOptionWidget {
+abstract class MailWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOptionWidget, IButtonWidget {
protected IURLGenerator $urlGenerator;
protected IUserManager $userManager;
protected AccountService $accountService;
@@ -85,12 +88,7 @@ public function getUrl(): ?string {
* @inheritDoc
*/
public function load(): void {
- Util::addScript(Application::APP_ID, 'dashboard');
-
- $this->initialState->provideInitialState(
- 'mail-accounts',
- $this->accountService->findByUserId($this->userId)
- );
+ // No assets need to be loaded anymore as the widget is rendered from the API
}
/**
@@ -154,10 +152,41 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7):
}, $emails);
}
+ /**
+ * @inheritDoc
+ */
+ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems {
+ $items = $this->getItems($userId, $since, $limit);
+ return new WidgetItems(
+ $items,
+ empty($items) ? $this->l10n->t('No message found yet') : '',
+ );
+ }
+
/**
* @inheritDoc
*/
public function getWidgetOptions(): WidgetOptions {
return new WidgetOptions(true);
}
+
+ /**
+ * @inheritDoc
+ */
+ public function getWidgetButtons(string $userId): array {
+ $buttons = [];
+
+ if ($this->userId !== null) {
+ $accounts = $this->accountService->findByUserId($this->userId);
+ if (empty($accounts)) {
+ $buttons[] = new WidgetButton(
+ WidgetButton::TYPE_SETUP,
+ $this->urlGenerator->linkToRouteAbsolute('mail.page.setup'),
+ $this->l10n->t('Set up an account'),
+ );
+ }
+ }
+
+ return $buttons;
+ }
}
diff --git a/lib/Dashboard/MailWidgetV2.php b/lib/Dashboard/MailWidgetV2.php
deleted file mode 100644
index 4ff925b20b..0000000000
--- a/lib/Dashboard/MailWidgetV2.php
+++ /dev/null
@@ -1,59 +0,0 @@
-= 27.1.0
- */
-abstract class MailWidgetV2 extends MailWidget implements IAPIWidgetV2, IButtonWidget {
-
- /**
- * @inheritDoc
- */
- public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems {
- $items = $this->getItems($userId, $since, $limit);
- return new WidgetItems(
- $items,
- empty($items) ? $this->l10n->t('No message found yet') : '',
- );
- }
-
- /**
- * @inheritDoc
- */
- public function load(): void {
- // No assets need to be loaded anymore as the widget is rendered from the API
- }
-
- /**
- * @inheritDoc
- */
- public function getWidgetButtons(string $userId): array {
- $buttons = [];
-
- if ($this->userId !== null) {
- $accounts = $this->accountService->findByUserId($this->userId);
- if (empty($accounts)) {
- $buttons[] = new WidgetButton(
- WidgetButton::TYPE_SETUP,
- $this->urlGenerator->linkToRouteAbsolute('mail.page.setup'),
- $this->l10n->t('Set up an account'),
- );
- }
- }
-
- return $buttons;
- }
-}
diff --git a/lib/Dashboard/UnreadMailWidgetV2.php b/lib/Dashboard/UnreadMailWidgetV2.php
deleted file mode 100644
index 7b46a3b893..0000000000
--- a/lib/Dashboard/UnreadMailWidgetV2.php
+++ /dev/null
@@ -1,36 +0,0 @@
-= 27.1.0
- */
-class UnreadMailWidgetV2 extends MailWidgetV2 {
- /**
- * @inheritDoc
- */
- public function getId(): string {
- return 'mail-unread';
- }
-
- /**
- * @inheritDoc
- */
- public function getTitle(): string {
- return $this->l10n->t('Unread mail');
- }
-
- /**
- * @inheritDoc
- */
- public function getSearchFilter(): string {
- return 'is:unread';
- }
-}
diff --git a/src/components/Dashboard.vue b/src/components/Dashboard.vue
deleted file mode 100644
index e539181d78..0000000000
--- a/src/components/Dashboard.vue
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/main-dashboard.js b/src/main-dashboard.js
deleted file mode 100644
index b093adc83e..0000000000
--- a/src/main-dashboard.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-import Vue from 'vue'
-import { getRequestToken } from '@nextcloud/auth'
-import { generateFilePath } from '@nextcloud/router'
-
-import Nextcloud from './mixins/Nextcloud.js'
-import DashboardImportant from './views/DashboardImportant.vue'
-import DashboardUnread from './views/DashboardUnread.vue'
-
-// eslint-disable-next-line camelcase
-__webpack_nonce__ = btoa(getRequestToken())
-// eslint-disable-next-line camelcase
-__webpack_public_path__ = generateFilePath('mail', '', 'js/')
-
-Vue.mixin(Nextcloud)
-
-document.addEventListener('DOMContentLoaded', function() {
- const register = OCA?.Dashboard?.register || (() => {})
-
- register('mail', (el) => {
- const View = Vue.extend(DashboardImportant)
- new View().$mount(el)
- })
-
- register('mail-unread', (el) => {
- const View = Vue.extend(DashboardUnread)
- new View().$mount(el)
- })
-})
diff --git a/src/views/DashboardImportant.vue b/src/views/DashboardImportant.vue
deleted file mode 100644
index 1622314529..0000000000
--- a/src/views/DashboardImportant.vue
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/views/DashboardUnread.vue b/src/views/DashboardUnread.vue
deleted file mode 100644
index 8071403179..0000000000
--- a/src/views/DashboardUnread.vue
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
diff --git a/webpack.common.js b/webpack.common.js
index d8d22ef800..b3f3d64796 100644
--- a/webpack.common.js
+++ b/webpack.common.js
@@ -42,7 +42,6 @@ const plugins = [
module.exports = {
entry: {
autoredirect: path.join(__dirname, 'src/autoredirect.js'),
- dashboard: path.join(__dirname, 'src/main-dashboard.js'),
mail: path.join(__dirname, 'src/main.js'),
oauthpopup: path.join(__dirname, 'src/main-oauth-popup.js'),
settings: path.join(__dirname, 'src/main-settings'),