Remove deprecated global API calls

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-04-27 16:23:49 +02:00
parent 7623a378f0
commit c940617478
12 changed files with 77 additions and 73 deletions

View File

@@ -100,6 +100,7 @@
import { mapGetters, mapState } from 'vuex'
import { Container, Draggable } from 'vue-smooth-dnd'
import { Actions, ActionButton } from '@nextcloud/vue'
import { showError } from '@nextcloud/dialogs'
import CardItem from '../cards/CardItem'
export default {
@@ -208,7 +209,7 @@ export default {
})
this.$router.push({ name: 'card', params: { cardId: newCard.id } })
} catch (e) {
OCP.Toast.error('Could not create card: ' + e.response.data.message)
showError('Could not create card: ' + e.response.data.message)
} finally {
this.stateCardCreating = false
}

View File

@@ -60,6 +60,7 @@
import { Actions, ActionButton } from '@nextcloud/vue'
import relativeDate from '../../mixins/relativeDate'
import { formatFileSize } from '@nextcloud/files'
import { generateUrl } from '@nextcloud/router'
export default {
name: 'AttachmentList',
@@ -101,7 +102,7 @@ export default {
}
},
attachmentUrl() {
return (attachment) => OC.generateUrl(`/apps/deck/cards/${attachment.cardId}/attachment/${attachment.id}`)
return (attachment) => generateUrl(`/apps/deck/cards/${attachment.cardId}/attachment/${attachment.id}`)
},
formattedFileSize() {
return (filesize) => formatFileSize(filesize)

View File

@@ -202,6 +202,7 @@ import MarkdownItTaskLists from 'markdown-it-task-lists'
import { formatFileSize } from '@nextcloud/files'
import relativeDate from '../../mixins/relativeDate'
import AttachmentList from './AttachmentList'
import { generateUrl } from '@nextcloud/router'
const markdownIt = new MarkdownIt({
linkify: true,
@@ -279,7 +280,7 @@ export default {
}
},
attachmentUrl() {
return (attachment) => OC.generateUrl(`/apps/deck/cards/${attachment.cardId}/attachment/${attachment.id}`)
return (attachment) => generateUrl(`/apps/deck/cards/${attachment.cardId}/attachment/${attachment.id}`)
},
formattedFileSize() {
return (filesize) => formatFileSize(filesize)

View File

@@ -35,7 +35,7 @@ import { Avatar } from '@nextcloud/vue'
import CommentItem from './CommentItem'
import CommentForm from './CommentForm'
import InfiniteLoading from 'vue-infinite-loading'
import { getCurrentUser } from '@nextcloud/auth'
export default {
name: 'CardSidebarTabComments',
components: {
@@ -54,7 +54,7 @@ export default {
return {
newComment: '',
isLoading: false,
currentUser: OC.getCurrentUser(),
currentUser: getCurrentUser(),
}
},
computed: {

View File

@@ -58,6 +58,7 @@
<script>
import { Avatar, PopoverMenu, Tooltip } from '@nextcloud/vue'
import { generateUrl } from '@nextcloud/router'
export default {
name: 'AvatarList',
@@ -93,7 +94,7 @@ export default {
}
const user = assignable.participant.uid
const size = 32
const avatarUrl = OC.generateUrl('/avatar/{user}/{size}',
const avatarUrl = generateUrl('/avatar/{user}/{size}',
{
user: user,
size: size,

View File

@@ -70,6 +70,8 @@
import { Modal, Actions, ActionButton, Multiselect } from '@nextcloud/vue'
import { mapGetters, mapState } from 'vuex'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { getCurrentUser } from '@nextcloud/auth'
export default {
name: 'CardMenu',
@@ -127,7 +129,7 @@ export default {
this.$store.dispatch('assignCardToUser', {
card: this.copiedCard,
assignee: {
userId: OC.getCurrentUser().uid,
userId: getCurrentUser()?.uid,
type: 0,
},
})
@@ -140,7 +142,7 @@ export default {
},
async loadStacksFromBoard(board) {
try {
const url = OC.generateUrl('/apps/deck/stacks/' + board.id)
const url = generateUrl('/apps/deck/stacks/' + board.id)
const response = await axios.get(url)
this.stacksFromBoard = response.data
} catch (err) {

View File

@@ -76,6 +76,7 @@ import { Multiselect } from '@nextcloud/vue'
import AppNavigationAddBoard from './AppNavigationAddBoard'
import AppNavigationBoardCategory from './AppNavigationBoardCategory'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
const canCreateState = loadState('deck', 'canCreate')
@@ -118,13 +119,13 @@ export default {
},
beforeMount() {
if (this.isAdmin) {
axios.get(OC.generateUrl('apps/deck/config')).then((response) => {
axios.get(generateUrl('apps/deck/config')).then((response) => {
this.groupLimit = response.data.groupLimit
this.groupLimitDisabled = false
}, (error) => {
console.error('Error while loading groupLimit', error.response)
})
axios.get(OC.linkToOCS('cloud', 2) + 'groups').then((response) => {
axios.get(generateOcsUrl('cloud', 2) + 'groups').then((response) => {
this.groups = response.data.ocs.data.groups.reduce((obj, item) => {
obj.push({
id: item,
@@ -146,7 +147,7 @@ export default {
},
updateConfig() {
this.groupLimitDisabled = true
axios.post(OC.generateUrl('apps/deck/config/groupLimit'), {
axios.post(generateUrl('apps/deck/config/groupLimit'), {
value: this.groupLimit,
}).then(() => {
this.groupLimitDisabled = false