summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-11-29 11:44:59 +0100
committerJulius Härtl <jus@bitgrid.net>2018-11-29 13:59:51 +0100
commit61f8bcf9cd7c5ae3f563cd48f1763b26256d4046 (patch)
tree0754dbce0c16ec106b71e1815e6e8aad5fde1471
parent59858d546d6c564e94172fb1124c1c9a6e8b12b6 (diff)
Use mixin for current user data
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--src/App.vue14
-rw-r--r--src/components/Composer.vue1
-rw-r--r--src/mixins/currentUserMixin.js8
-rw-r--r--src/mixins/serverData.js29
4 files changed, 38 insertions, 14 deletions
diff --git a/src/App.vue b/src/App.vue
index d27f5c4d..8d1f4c34 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -63,6 +63,7 @@ import axios from 'nextcloud-axios'
import TimelineEntry from './components/TimelineEntry'
import ProfileInfo from './components/ProfileInfo'
import Search from './components/Search'
+import currentuserMixin from './mixins/currentUserMixin'
export default {
name: 'App',
@@ -75,6 +76,7 @@ export default {
ProfileInfo,
Search
},
+ mixins: [currentuserMixin],
data: function() {
return {
infoHidden: false,
@@ -84,21 +86,9 @@ export default {
}
},
computed: {
- url: function() {
- return OC.linkTo('social', 'img/nextcloud.png')
- },
- currentUser: function() {
- return OC.getCurrentUser()
- },
- socialId: function() {
- return '@' + OC.getCurrentUser().uid + '@' + OC.getHost()
- },
timeline: function() {
return this.$store.getters.getTimeline
},
- serverData: function() {
- return this.$store.getters.getServerData
- },
menu: function() {
let defaultCategories = [
{
diff --git a/src/components/Composer.vue b/src/components/Composer.vue
index f3fb5bbc..f5396deb 100644
--- a/src/components/Composer.vue
+++ b/src/components/Composer.vue
@@ -28,7 +28,6 @@
<form class="new-post-form" @submit.prevent="createPost">
<div class="author currentUser">
{{ currentUser.displayName }}
-
<span class="social-id">{{ socialId }}</span>
</div>
<vue-tribute :options="tributeOptions">
diff --git a/src/mixins/currentUserMixin.js b/src/mixins/currentUserMixin.js
index 434aeac5..8bc5adfa 100644
--- a/src/mixins/currentUserMixin.js
+++ b/src/mixins/currentUserMixin.js
@@ -20,13 +20,19 @@
*
*/
+import serverData from './serverData'
export default {
+ mixins: [
+ serverData
+ ],
computed: {
currentUser: function() {
return OC.getCurrentUser()
},
socialId: function() {
- return '@' + OC.getCurrentUser().uid + '@' + OC.getHost()
+ const url = document.createElement('a')
+ url.setAttribute('href', this.serverData.cloudAddress)
+ return '@' + OC.getCurrentUser().uid + '@' + url.hostname
}
}
}
diff --git a/src/mixins/serverData.js b/src/mixins/serverData.js
new file mode 100644
index 00000000..24783e3c
--- /dev/null
+++ b/src/mixins/serverData.js
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+export default {
+ computed: {
+ serverData: function() {
+ return this.$store.getters.getServerData
+ }
+ }
+}