summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-10-09 18:16:40 +0200
committerRobin Appelman <robin@icewind.nl>2020-10-12 17:03:49 +0200
commit2ef6613857e3f11c017a516aa06871665b203ddb (patch)
tree1366735c8b499ef98a8fec72232d1caebfd04c24
parent6ec6fc50f1e798b2243bf38fce0345572c1140d2 (diff)
migrate away from depricated OC.generateUrl
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--package-lock.json84
-rw-r--r--package.json1
-rw-r--r--src/App.vue3
-rw-r--r--src/components/ActorAvatar.vue3
-rw-r--r--src/components/Composer.vue11
-rw-r--r--src/components/MessageContent.js2
-rw-r--r--src/components/PostAttachment.vue5
-rw-r--r--src/components/ProfileInfo.vue5
-rw-r--r--src/components/Search.vue7
-rw-r--r--src/components/TimelinePost.vue6
-rw-r--r--src/components/UserEntry.vue3
-rw-r--r--src/mixins/follow.js5
-rw-r--r--src/router.js3
-rw-r--r--src/store/account.js13
-rw-r--r--src/store/timeline.js23
-rw-r--r--src/views/OStatus.vue5
16 files changed, 139 insertions, 40 deletions
diff --git a/package-lock.json b/package-lock.json
index f450eed6..5124d8ab 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3543,6 +3543,57 @@
"core-js": "^3.6.4"
}
},
+ "@nextcloud/moment": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@nextcloud/moment/-/moment-1.1.1.tgz",
+ "integrity": "sha512-lh7Xn9Ver12pLfE0rpjxE6x/ipscAV+7fw1u+7TJak1QR1T1UDRMZ9dA7z77W8mZH2C3yveTh/VEHZIflKBrng==",
+ "requires": {
+ "@nextcloud/l10n": "1.2.0",
+ "core-js": "3.6.4",
+ "jed": "^1.1.1",
+ "moment": "2.24.0",
+ "node-gettext": "^2.0.0"
+ },
+ "dependencies": {
+ "@nextcloud/l10n": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@nextcloud/l10n/-/l10n-1.2.0.tgz",
+ "integrity": "sha512-aPsVAewCYMNe2h0yse3Fj7LofvnvFPimojw24K47ip1+I1gawMIsQL+BYAnN8wzlcbsDTEc7I1FxtOh+8dHHIA==",
+ "requires": {
+ "core-js": "^3.6.4",
+ "node-gettext": "^3.0.0"
+ },
+ "dependencies": {
+ "node-gettext": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/node-gettext/-/node-gettext-3.0.0.tgz",
+ "integrity": "sha512-/VRYibXmVoN6tnSAY2JWhNRhWYJ8Cd844jrZU/DwLVoI4vBI6ceYbd8i42sYZ9uOgDH3S7vslIKOWV/ZrT2YBA==",
+ "requires": {
+ "lodash.get": "^4.4.2"
+ }
+ }
+ }
+ },
+ "core-js": {
+ "version": "3.6.4",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz",
+ "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw=="
+ },
+ "moment": {
+ "version": "2.24.0",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
+ "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
+ },
+ "node-gettext": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/node-gettext/-/node-gettext-2.1.0.tgz",
+ "integrity": "sha512-vsHImHl+Py0vB7M2UXcFEJ5NJ3950gcja45YclBFtYxYeZiqdfQdcu+G9s4L7jpRFSh/J/7VoS3upR4JM1nS+g==",
+ "requires": {
+ "lodash.get": "^4.4.2"
+ }
+ }
+ }
+ },
"@nextcloud/router": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-1.2.0.tgz",
@@ -6963,6 +7014,7 @@
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.2.2",
+ "is-negative-zero": "^2.0.0",
"is-regex": "^1.1.1",
"object-inspect": "^1.8.0",
"object-keys": "^1.1.1",
@@ -6977,8 +7029,30 @@
"integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==",
"requires": {
"define-properties": "^1.1.3",
+ "es-abstract": "^1.18.0-next.0",
"has-symbols": "^1.0.1",
"object-keys": "^1.1.1"
+ },
+ "dependencies": {
+ "es-abstract": {
+ "version": "1.18.0-next.1",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz",
+ "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==",
+ "requires": {
+ "es-to-primitive": "^1.2.1",
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1",
+ "is-callable": "^1.2.2",
+ "is-negative-zero": "^2.0.0",
+ "is-regex": "^1.1.1",
+ "object-inspect": "^1.8.0",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.1",
+ "string.prototype.trimend": "^1.0.1",
+ "string.prototype.trimstart": "^1.0.1"
+ }
+ }
}
}
}
@@ -9235,6 +9309,11 @@
"is-path-inside": "^3.0.1"
}
},
+ "is-negative-zero": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz",
+ "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE="
+ },
"is-number": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
@@ -9542,6 +9621,11 @@
"plist": "^3.0.1"
}
},
+ "jed": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/jed/-/jed-1.1.1.tgz",
+ "integrity": "sha1-elSbvZ/+FYWwzQoZHiAwVb7ldLQ="
+ },
"jest": {
"version": "26.4.2",
"resolved": "https://registry.npmjs.org/jest/-/jest-26.4.2.tgz",
diff --git a/package.json b/package.json
index 651412ad..2f0f6b2d 100644
--- a/package.json
+++ b/package.json
@@ -34,6 +34,7 @@
"@nextcloud/axios": "^1.4.0",
"@nextcloud/initial-state": "^1.1.2",
"@nextcloud/logger": "^1.1.2",
+ "@nextcloud/moment": "^1.1.1",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^2.6.8",
"he": "^1.2.0",
diff --git a/src/App.vue b/src/App.vue
index 572000a6..78ac28d1 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -97,6 +97,7 @@ import axios from '@nextcloud/axios'
import Search from './components/Search.vue'
import currentuserMixin from './mixins/currentUserMixin'
import { loadState } from '@nextcloud/initial-state'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'App',
@@ -214,7 +215,7 @@ export default {
this.infoHidden = true
},
setCloudAddress() {
- axios.post(OC.generateUrl('apps/social/api/v1/config/cloudAddress'), { cloudAddress: this.cloudAddress }).then((response) => {
+ axios.post(generateUrl('apps/social/api/v1/config/cloudAddress'), { cloudAddress: this.cloudAddress }).then((response) => {
this.$store.commit('setServerDataEntry', 'setup', false)
this.$store.commit('setServerDataEntry', 'cloudAddress', this.cloudAddress)
})
diff --git a/src/components/ActorAvatar.vue b/src/components/ActorAvatar.vue
index d45954dd..769265b3 100644
--- a/src/components/ActorAvatar.vue
+++ b/src/components/ActorAvatar.vue
@@ -29,6 +29,7 @@
<script>
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'ActorAvatar',
@@ -46,7 +47,7 @@ export default {
},
computed: {
avatarUrl() {
- return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
+ return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
}
}
}
diff --git a/src/components/Composer.vue b/src/components/Composer.vue
index 922dec84..f14a93a3 100644
--- a/src/components/Composer.vue
+++ b/src/components/Composer.vue
@@ -397,6 +397,7 @@ import CurrentUserMixin from './../mixins/currentUserMixin'
import FocusOnCreate from '../directives/focusOnCreate'
import axios from '@nextcloud/axios'
import ActorAvatar from './ActorAvatar.vue'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'Composer',
@@ -453,7 +454,7 @@ export default {
key: user.preferredUsername,
value: user.account,
url: user.url,
- avatar: user.local ? OC.generateUrl(`/avatar/${user.preferredUsername}/32`) : OC.generateUrl(`apps/social/api/v1/global/actor/avatar?id=${user.id}`)
+ avatar: user.local ? generateUrl(`/avatar/${user.preferredUsername}/32`) : generateUrl(`apps/social/api/v1/global/actor/avatar?id=${user.id}`)
})
}
cb(users)
@@ -474,7 +475,7 @@ export default {
tag = item.original.value
}
return '<span class="hashtag" contenteditable="false">'
- + '<a href="' + OC.generateUrl('/timeline/tags/' + tag) + '" target="_blank">#' + tag + '</a></span>'
+ + '<a href="' + generateUrl('/timeline/tags/' + tag) + '" target="_blank">#' + tag + '</a></span>'
},
values: (text, cb) => {
let tags = []
@@ -691,7 +692,7 @@ export default {
if (e.target.result.startsWith('data:image')) {
img.src = e.target.result
} else {
- img.src = OC.generateUrl('svg/core/filetypes/x-office-document?color=d8d8d8')
+ img.src = generateUrl('svg/core/filetypes/x-office-document?color=d8d8d8')
}
}
@@ -824,10 +825,10 @@ export default {
},
remoteSearchAccounts(text) {
- return axios.get(OC.generateUrl('apps/social/api/v1/global/accounts/search?search=' + text))
+ return axios.get(generateUrl('apps/social/api/v1/global/accounts/search?search=' + text))
},
remoteSearchHashtags(text) {
- return axios.get(OC.generateUrl('apps/social/api/v1/global/tags/search?search=' + text))
+ return axios.get(generateUrl('apps/social/api/v1/global/tags/search?search=' + text))
}
}
}
diff --git a/src/components/MessageContent.js b/src/components/MessageContent.js
index d2637a41..ff4e23cf 100644
--- a/src/components/MessageContent.js
+++ b/src/components/MessageContent.js
@@ -65,7 +65,7 @@ function transformText(createElement, text) {
to: {
name: 'profile',
params: { account: match[2].substr(1) }
- },
+ }
}
},
[match[3]]
diff --git a/src/components/PostAttachment.vue b/src/components/PostAttachment.vue
index bd6cbb27..0f70552e 100644
--- a/src/components/PostAttachment.vue
+++ b/src/components/PostAttachment.vue
@@ -1,7 +1,7 @@
<template>
<masonry>
<div v-for="(item, index) in attachments" :key="index">
- <img :src="OC.generateUrl('/apps/social/document/get/resized?id=' + item.id)" @click="showModal(index)">
+ <img :src="generateUrl('/apps/social/document/get/resized?id=' + item.id)" @click="showModal(index)">
</div>
<modal v-show="modal" :has-previous="current > 0" :has-next="current < (attachments.length - 1)"
size="full" @close="closeModal" @previous="showPrevious"
@@ -16,6 +16,7 @@
<script>
import Modal from '@nextcloud/vue/dist/Components/Modal'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'PostAttachment',
@@ -55,7 +56,7 @@ export default {
canvas.height = height
ctx.drawImage(img, 0, 0, width, height)
}
- img.src = OC.generateUrl('/apps/social/document/get?id=' + this.attachments[this.current].id)
+ img.src = generateUrl('/apps/social/document/get?id=' + this.attachments[this.current].id)
},
showModal(idx) {
this.current = idx
diff --git a/src/components/ProfileInfo.vue b/src/components/ProfileInfo.vue
index e51b2409..56ce0aa2 100644
--- a/src/components/ProfileInfo.vue
+++ b/src/components/ProfileInfo.vue
@@ -101,6 +101,7 @@ import serverData from '../mixins/serverData'
import currentUser from '../mixins/currentUserMixin'
import follow from '../mixins/follow'
import FollowButton from './FollowButton.vue'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'ProfileInfo',
@@ -145,12 +146,12 @@ export default {
return (field) => this.accountInfo.details.count ? this.accountInfo.details.count[field] : ''
},
avatarUrl() {
- return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
+ return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
}
},
methods: {
followRemote() {
- window.open(OC.generateUrl('/apps/social/api/v1/ostatus/followRemote/' + encodeURI(this.localUid)), 'followRemote', 'width=433,height=600toolbar=no,menubar=no,scrollbars=yes,resizable=yes')
+ window.open(generateUrl('/apps/social/api/v1/ostatus/followRemote/' + encodeURI(this.localUid)), 'followRemote', 'width=433,height=600toolbar=no,menubar=no,scrollbars=yes,resizable=yes')
}
}
}
diff --git a/src/components/Search.vue b/src/components/Search.vue
index 060880e6..e19d23c6 100644
--- a/src/components/Search.vue
+++ b/src/components/Search.vue
@@ -81,6 +81,7 @@
import UserEntry from './UserEntry.vue'
import axios from '@nextcloud/axios'
import Trend from 'vuetrend'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'Search',
@@ -153,14 +154,14 @@ export default {
},
accountSearch(term) {
this.loading = true
- return axios.get(OC.generateUrl('apps/social/api/v1/global/accounts/search?search=' + term))
+ return axios.get(generateUrl('apps/social/api/v1/global/accounts/search?search=' + term))
},
searchQuery(term) {
this.loading = true
- return axios.get(OC.generateUrl('apps/social/api/v1/search?search=' + term))
+ return axios.get(generateUrl('apps/social/api/v1/search?search=' + term))
},
remoteSearch(term) {
- return axios.get(OC.generateUrl('apps/social/api/v1/global/account/info?account=' + term))
+ return axios.get(generateUrl('apps/social/api/v1/global/account/info?account=' + term))
}
}
}
diff --git a/src/components/TimelinePost.vue b/src/components/TimelinePost.vue
index 663914c3..d3ff2318 100644
--- a/src/components/TimelinePost.vue
+++ b/src/components/TimelinePost.vue
@@ -65,6 +65,8 @@ import popoverMenu from './../mixins/popoverMenu'
import currentUser from './../mixins/currentUserMixin'
import PostAttachment from './PostAttachment.vue'
import MessageContent from './MessageContent'
+import moment from '@nextcloud/moment'
+import { generateUrl } from '@nextcloud/router'
pluginMention(linkify)
@@ -103,7 +105,7 @@ export default {
return actions
},
relativeTimestamp() {
- return OC.Util.relativeModifiedDate(this.item.published)
+ return moment(this.item.published).fromNow()
},
timestamp() {
return Date.parse(this.item.published)
@@ -119,7 +121,7 @@ export default {
return JSON.parse(this.item.source)
},
avatarUrl() {
- return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
+ return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
},
hasAttachments() {
return (typeof this.item.attachment !== 'undefined')
diff --git a/src/components/UserEntry.vue b/src/components/UserEntry.vue
index 1bb3c95e..a6feec6c 100644
--- a/src/components/UserEntry.vue
+++ b/src/components/UserEntry.vue
@@ -59,6 +59,7 @@ import Avatar from '@nextcloud/vue/dist/Components/Avatar'
import follow from '../mixins/follow'
import currentUser from '../mixins/currentUserMixin'
import FollowButton from './FollowButton.vue'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'UserEntry',
@@ -86,7 +87,7 @@ export default {
return this.item.id
},
avatarUrl() {
- return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.id)
+ return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.id)
}
}
}
diff --git a/src/mixins/follow.js b/src/mixins/follow.js
index 608011fe..8b74ec82 100644
--- a/src/mixins/follow.js
+++ b/src/mixins/follow.js
@@ -21,6 +21,7 @@
*/
import axios from '@nextcloud/axios'
+import { generateUrl } from '@nextcloud/router'
class FollowException {
@@ -39,7 +40,7 @@ export default {
methods: {
follow() {
this.followLoading = true
- return axios.put(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
+ return axios.put(generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
this.followLoading = false
if (response.data.status === -1) {
throw new FollowException()
@@ -54,7 +55,7 @@ export default {
},
unfollow() {
this.followLoading = true
- return axios.delete(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
+ return axios.delete(generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
this.followLoading = false
if (response.data.status === -1) {
throw new UnfollowException()
diff --git a/src/router.js b/src/router.js
index d2b281c9..fecd0a71 100644
--- a/src/router.js
+++ b/src/router.js
@@ -23,6 +23,7 @@
*/
import Vue from 'vue'
import Router from 'vue-router'
+import { generateUrl } from '@nextcloud/router'
// Dynamic loading
const Timeline = () => import('./views/Timeline.vue')
@@ -37,7 +38,7 @@ export default new Router({
mode: 'history',
// if index.php is in the url AND we got this far, then it's working:
// let's keep using index.php in the url
- base: OC.generateUrl(''),
+ base: generateUrl(''),
linkActiveClass: 'active',
routes: [
{
diff --git a/src/store/account.js b/src/store/account.js
index 2ece11e0..91d7b272 100644
--- a/src/store/account.js
+++ b/src/store/account.js
@@ -22,6 +22,7 @@
import axios from '@nextcloud/axios'
import Vue from 'vue'
+import { generateUrl } from '@nextcloud/router'
const state = {
currentAccount: {},
@@ -108,7 +109,7 @@ const getters = {
const actions = {
fetchAccountInfo(context, account) {
- return axios.get(OC.generateUrl(`apps/social/api/v1/global/account/info?account=${account}`)).then((response) => {
+ return axios.get(generateUrl(`apps/social/api/v1/global/account/info?account=${account}`)).then((response) => {
context.commit('addAccount', { actorId: response.data.result.account.id, data: response.data.result.account })
return response.data.result.account
}).catch(() => {
@@ -116,7 +117,7 @@ const actions = {
})
},
fetchPublicAccountInfo(context, uid) {
- return axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/info`)).then((response) => {
+ return axios.get(generateUrl(`apps/social/api/v1/account/${uid}/info`)).then((response) => {
context.commit('addAccount', { actorId: response.data.result.account.id, data: response.data.result.account })
return response.data.result.account
}).catch(() => {
@@ -128,7 +129,7 @@ const actions = {
dispatch('fetchAccountInfo', account)
},
followAccount(context, { currentAccount, accountToFollow }) {
- return axios.put(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + accountToFollow)).then((response) => {
+ return axios.put(generateUrl('/apps/social/api/v1/current/follow?account=' + accountToFollow)).then((response) => {
if (response.data.status === -1) {
return Promise.reject(response)
}
@@ -141,7 +142,7 @@ const actions = {
},
unfollowAccount(context, { currentAccount, accountToUnfollow }) {
- return axios.delete(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + accountToUnfollow)).then((response) => {
+ return axios.delete(generateUrl('/apps/social/api/v1/current/follow?account=' + accountToUnfollow)).then((response) => {
if (response.data.status === -1) {
return Promise.reject(response)
}
@@ -157,7 +158,7 @@ const actions = {
// TODO: fetching followers/following information of remotes is currently not supported
const parts = account.split('@')
const uid = (parts.length === 2 ? parts[0] : account)
- axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/followers`)).then((response) => {
+ axios.get(generateUrl(`apps/social/api/v1/account/${uid}/followers`)).then((response) => {
context.commit('addFollowers', { account, data: response.data.result })
})
},
@@ -165,7 +166,7 @@ const actions = {
// TODO: fetching followers/following information of remotes is currently not supported
const parts = account.split('@')
const uid = (parts.length === 2 ? parts[0] : account)
- axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/following`)).then((response) => {
+ axios.get(generateUrl(`apps/social/api/v1/account/${uid}/following`)).then((response) => {
context.commit('addFollowing', { account, data: response.data.result })
})
}
diff --git a/src/store/timeline.js b/src/store/timeline.js
index 5275ea55..e61a1219 100644
--- a/src/store/timeline.js
+++ b/src/store/timeline.js
@@ -24,6 +24,7 @@
import Logger from '../logger'
import axios from '@nextcloud/axios'
import Vue from 'vue'
+import { generateUrl } from '@nextcloud/router'
const state = {
timeline: {},
@@ -118,7 +119,7 @@ const actions = {
},
post(context, post) {
return new Promise((resolve, reject) => {
- axios.post(OC.generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => {
+ axios.post(generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => {
// eslint-disable-next-line no-console
console.log('Post created with token ' + response.data.result.token)
resolve(response)
@@ -130,7 +131,7 @@ const actions = {
})
},
postDelete(context, post) {
- return axios.delete(OC.generateUrl(`apps/social/api/v1/post?id=${post.id}`)).then((response) => {
+ return axios.delete(generateUrl(`apps/social/api/v1/post?id=${post.id}`)).then((response) => {
context.commit('removePost', post)
// eslint-disable-next-line no-console
console.log('Post deleted with token ' + response.data.result.token)
@@ -141,7 +142,7 @@ const actions = {
},
postLike(context, { post, parentAnnounce }) {
return new Promise((resolve, reject) => {
- axios.post(OC.generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
+ axios.post(generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
context.commit('likePost', { post, parentAnnounce })
resolve(response)
}).catch((error) => {
@@ -152,7 +153,7 @@ const actions = {
})
},
postUnlike(context, { post, parentAnnounce }) {
- return axios.delete(OC.generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
+ return axios.delete(generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
context.commit('unlikePost', { post, parentAnnounce })
// Remove post from list if we are in the 'liked' timeline
if (state.type === 'liked') {
@@ -165,7 +166,7 @@ const actions = {
},
postBoost(context, { post, parentAnnounce }) {
return new Promise((resolve, reject) => {
- axios.post(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
+ axios.post(generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
context.commit('boostPost', { post, parentAnnounce })
// eslint-disable-next-line no-console
console.log('Post boosted with token ' + response.data.result.token)
@@ -178,7 +179,7 @@ const actions = {
})
},
postUnBoost(context, { post, parentAnnounce }) {
- return axios.delete(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
+ return axios.delete(generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
context.commit('unboostPost', { post, parentAnnounce })
// eslint-disable-next-line no-console
console.log('Boost deleted with token ' + response.data.result.token)
@@ -199,13 +200,13 @@ const actions = {
// Compute URl to get the data
let url = ''
if (state.type === 'account') {
- url = OC.generateUrl(`apps/social/api/v1/account/${state.account}/stream?limit=25&since=` + sinceTimestamp)
+ url = generateUrl(`apps/social/api/v1/account/${state.account}/stream?limit=25&since=` + sinceTimestamp)
} else if (state.type === 'tags') {
- url = OC.generateUrl(`apps/social/api/v1/stream/tag/${state.params.tag}?limit=25&since=` + sinceTimestamp)
+ url = generateUrl(`apps/social/api/v1/stream/tag/${state.params.tag}?limit=25&since=` + sinceTimestamp)
} else if (state.type === 'single-post') {
- url = OC.generateUrl(`apps/social/local/v1/post/replies?id=${state.params.id}&limit=5&since=` + sinceTimestamp)
+ url = generateUrl(`apps/social/local/v1/post/replies?id=${state.params.id}&limit=5&since=` + sinceTimestamp)
} else {
- url = OC.generateUrl(`apps/social/api/v1/stream/${state.type}?limit=25&since=` + sinceTimestamp)
+ url = generateUrl(`apps/social/api/v1/stream/${state.type}?limit=25&since=` + sinceTimestamp)
}
// Get the data and add them to the timeline
@@ -220,7 +221,7 @@ const actions = {
// Also load replies when displaying a single post timeline
if (state.type === 'single-post') {
result.push(response.data)
- // axios.get(OC.generateUrl(``)).then((response) => {
+ // axios.get(generateUrl(``)).then((response) => {
// if (response.status !== -1) {
// result.concat(response.data.result)
// }
diff --git a/src/views/OStatus.vue b/src/views/OStatus.vue
index 978749c3..bdbe822c 100644
--- a/src/views/OStatus.vue
+++ b/src/views/OStatus.vue
@@ -64,6 +64,7 @@ import Avatar from '@nextcloud/vue/dist/Components/Avatar'
import axios from '@nextcloud/axios'
import currentuserMixin from './../mixins/currentUserMixin'
import { loadState } from '@nextcloud/initial-state'
+import { generateUrl } from '@nextcloud/router'
export default {
name: 'App',
@@ -84,7 +85,7 @@ export default {
return this.serverData.account
},
avatarUrl() {
- return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
+ return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
},
accountInfo: function() {
return this.$store.getters.getAccount(this.serverData.account)
@@ -124,7 +125,7 @@ export default {
})
},
followRemote() {
- axios.get(OC.generateUrl(`/apps/social/api/v1/ostatus/link/${this.serverData.local}/` + encodeURI(this.remote))).then((a) => {
+ axios.get(generateUrl(`/apps/social/api/v1/ostatus/link/${this.serverData.local}/` + encodeURI(this.remote))).then((a) => {
window.location = a.data.result.url
})
},