summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-09-14 15:39:47 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-09-14 16:10:36 +0200
commitc683f9135a3c98b446563856ece89f8b422ecc51 (patch)
treeafefe3f49542d4afe39a2d7c6afb67178f4af7f9
parentb009d25e13ded79514de5818f2fb3496323ce08e (diff)
Port to new Dashboard api
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r--lib/Dashboard/SocialWidget.php17
-rw-r--r--src/dashboard.js8
-rw-r--r--src/views/Dashboard.vue22
-rw-r--r--webpack.common.js2
4 files changed, 30 insertions, 19 deletions
diff --git a/lib/Dashboard/SocialWidget.php b/lib/Dashboard/SocialWidget.php
index 495dddcb..b50640af 100644
--- a/lib/Dashboard/SocialWidget.php
+++ b/lib/Dashboard/SocialWidget.php
@@ -23,19 +23,21 @@
namespace OCA\Social\Dashboard;
+use OCP\IURLGenerator;
use OCP\Dashboard\IWidget;
use OCP\IL10N;
use OCA\Social\AppInfo\Application;
class SocialWidget implements IWidget {
-
- /** @var IL10N */
- private $l10n;
+ private IL10N $l10n;
+ private IURLGenerator $urlGenerator;
public function __construct(
- IL10N $l10n
+ IL10N $l10n,
+ IURLGenerator $urlGenerator
) {
$this->l10n = $l10n;
+ $this->urlGenerator = $urlGenerator;
}
/**
@@ -70,14 +72,13 @@ class SocialWidget implements IWidget {
* @inheritDoc
*/
public function getUrl(): ?string {
- return \OC::$server->getURLGenerator()->linkToRoute('social.local.streamNotifications', []);
+ return ''; //$this->uRLGenerator->linkToRoute('social.local.streamNotifications', []);
}
/**
* @inheritDoc
*/
public function load(): void {
- \OC_Util::addScript(Application::APP_NAME, 'dashboard');
- \OC_Util::addStyle(Application::APP_NAME, 'dashboard');
+ \OCP\Util::addScript(Application::APP_NAME, 'social-dashboard');
}
-} \ No newline at end of file
+}
diff --git a/src/dashboard.js b/src/dashboard.js
index 8c2720ef..d58ad980 100644
--- a/src/dashboard.js
+++ b/src/dashboard.js
@@ -14,18 +14,20 @@
import Vue from 'vue'
import Dashboard from './views/Dashboard.vue'
+// eslint-disable-next-line
+__webpack_nonce__ = btoa(OC.requestToken);
+// eslint-disable-next-line
+__webpack_public_path__ = OC.linkTo('social', 'js/');
+
Vue.prototype.t = t
Vue.prototype.n = n
Vue.prototype.OC = window.OC
-Vue.prototype.OCA = window.OCA
document.addEventListener('DOMContentLoaded', function() {
-
OCA.Dashboard.register('social_notifications', (el, { widget }) => {
const View = Vue.extend(Dashboard)
new View({
propsData: { title: widget.title }
}).$mount(el)
})
-
})
diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue
index ead86748..25a56c59 100644
--- a/src/views/Dashboard.vue
+++ b/src/views/Dashboard.vue
@@ -1,10 +1,10 @@
<template>
- <DashboardWidget :items="items"
+ <NcDashboardWidget :items="items"
:show-more-url="showMoreUrl"
:show-more-text="title"
:loading="state === 'loading'">
<template #empty-content>
- <EmptyContent
+ <NcEmptyContent
v-if="emptyContentMessage"
:icon="emptyContentIcon">
<template #desc>
@@ -15,24 +15,24 @@
</a>
</div>
</template>
- </EmptyContent>
+ </NcEmptyContent>
</template>
- </DashboardWidget>
+ </NcDashboardWidget>
</template>
<script>
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
-import { DashboardWidget } from '@nextcloud/vue-dashboard'
-import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
+import NcDashboardWidget from '@nextcloud/vue/dist/Components/NcDashboardWidget.js'
+import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
export default {
name: 'Dashboard',
components: {
- DashboardWidget,
- EmptyContent
+ NcDashboardWidget,
+ NcEmptyContent
},
props: {
@@ -152,6 +152,9 @@ export default {
if (n.subtype === 'Follow') {
return t('social', '{account} is following you', { account: this.getActorName(n) })
}
+ if (n.subtype === 'Like') {
+ return t('social', '{account} liked your post', { account: this.getActorName(n) })
+ }
},
getAvatarUrl(n) {
return undefined
@@ -180,6 +183,9 @@ export default {
if (n.subtype === 'Follow') {
return this.getActorAccountName(n)
}
+ if (n.subtype === 'Like') {
+ return this.getActorAccountName(n)
+ }
return ''
},
getNotificationTypeImage(n) {
diff --git a/webpack.common.js b/webpack.common.js
index 132c04a3..dcacd5d9 100644
--- a/webpack.common.js
+++ b/webpack.common.js
@@ -10,3 +10,5 @@ webpackConfig.entry = {
profilePage: path.join(__dirname, 'src', 'profile.js'),
dashboard: path.join(__dirname, 'src', 'dashboard.js'),
}
+
+module.exports = webpackConfig