From 5448b4fa76e825a92af059254db9bb462ec251c0 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Fri, 10 Jul 2020 15:14:45 -0400 Subject: [PATCH] Various changes to adhere to new api --- src/displays/user/index.ts | 2 +- src/modules/users/routes/detail/detail.vue | 2 +- src/stores/user/types.ts | 4 +--- .../comments-drawer-detail/comment-item-header.vue | 6 ++---- .../comments-drawer-detail/comments-drawer-detail.vue | 4 +--- .../components/module-bar-avatar/module-bar-avatar.vue | 7 ++----- src/views/private/components/user-popover/user-popover.vue | 2 +- 7 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/displays/user/index.ts b/src/displays/user/index.ts index a3acd23798..ecdb43ecb7 100644 --- a/src/displays/user/index.ts +++ b/src/displays/user/index.ts @@ -29,5 +29,5 @@ export default defineDisplay(({ i18n }) => ({ default_value: false, }, ], - fields: ['id', 'avatar.data', 'first_name', 'last_name'], + fields: ['id', 'avatar.id', 'first_name', 'last_name'], })); diff --git a/src/modules/users/routes/detail/detail.vue b/src/modules/users/routes/detail/detail.vue index d12b27d461..7f7a7fc593 100644 --- a/src/modules/users/routes/detail/detail.vue +++ b/src/modules/users/routes/detail/detail.vue @@ -299,7 +299,7 @@ export default defineComponent({ try { const response = await api.get(`/users/${props.primaryKey}`, { params: { - fields: ['role.name', 'avatar.data'], + fields: ['role.name', 'avatar.id'], }, }); diff --git a/src/stores/user/types.ts b/src/stores/user/types.ts index 7bf40dbda0..d94222dc75 100644 --- a/src/stores/user/types.ts +++ b/src/stores/user/types.ts @@ -23,9 +23,7 @@ export type Role = { }; export type Avatar = { - data: { - thumbnails: Thumbnail[]; - }; + id: string; }; type Thumbnail = { diff --git a/src/views/private/components/comments-drawer-detail/comment-item-header.vue b/src/views/private/components/comments-drawer-detail/comment-item-header.vue index 7fc326ad3e..4f03a9c645 100644 --- a/src/views/private/components/comments-drawer-detail/comment-item-header.vue +++ b/src/views/private/components/comments-drawer-detail/comment-item-header.vue @@ -69,6 +69,7 @@ import { defineComponent, PropType, computed, ref, watch } from '@vue/compositio import { Activity } from './types'; import format from 'date-fns/format'; import i18n from '@/lang'; +import getRootPath from '@/utils/get-root-path'; import api from '@/api'; import localizedFormat from '@/utils/localized-format'; @@ -111,10 +112,7 @@ export default defineComponent({ const avatarSource = computed(() => { if (!props.activity.action_by?.avatar) return null; - return ( - props.activity.action_by.avatar.data.thumbnails.find((thumb) => thumb.key === 'directus-small-crop') - ?.url || null - ); + return getRootPath() + `assets/${props.activity.action_by.avatar.id}?key=directus-small-cover`; }); const { confirmDelete, deleting, remove } = useDelete(); diff --git a/src/views/private/components/comments-drawer-detail/comments-drawer-detail.vue b/src/views/private/components/comments-drawer-detail/comments-drawer-detail.vue index ea422c1daa..04fd3dbf5b 100644 --- a/src/views/private/components/comments-drawer-detail/comments-drawer-detail.vue +++ b/src/views/private/components/comments-drawer-detail/comments-drawer-detail.vue @@ -77,7 +77,6 @@ export default defineComponent({ 'filter[collection][eq]': collection, 'filter[item][eq]': primaryKey, 'filter[action][in]': 'comment', - 'filter[comment_deleted_on][null]': 1, sort: '-id', // directus_activity has auto increment and is therefore in chronological order fields: [ 'id', @@ -86,9 +85,8 @@ export default defineComponent({ 'action_by.id', 'action_by.first_name', 'action_by.last_name', - 'action_by.avatar.data', + 'action_by.avatar.id', 'comment', - 'edited_on', ], }, }); diff --git a/src/views/private/components/module-bar-avatar/module-bar-avatar.vue b/src/views/private/components/module-bar-avatar/module-bar-avatar.vue index 3c18762854..4990424048 100644 --- a/src/views/private/components/module-bar-avatar/module-bar-avatar.vue +++ b/src/views/private/components/module-bar-avatar/module-bar-avatar.vue @@ -38,6 +38,7 @@