From 69f4f0a3ecdffd109e75a95688e698af30a666e4 Mon Sep 17 00:00:00 2001 From: elizavetaRa Date: Mon, 22 May 2023 15:59:07 +0200 Subject: [PATCH 1/2] Update favorites resources list on remove from favorites --- packages/web-app-files/src/store/actions.ts | 4 ++++ packages/web-app-files/src/views/Favorites.vue | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/web-app-files/src/store/actions.ts b/packages/web-app-files/src/store/actions.ts index d819009ee84..8003d68b671 100644 --- a/packages/web-app-files/src/store/actions.ts +++ b/packages/web-app-files/src/store/actions.ts @@ -19,6 +19,7 @@ import { ClientService, LoadingTaskCallbackArguments } from 'web-pkg/src/service import { Language } from 'vue3-gettext' import { DavProperty } from 'web-client/src/webdav/constants' import { AncestorMetaData } from 'web-app-files/src/helpers/resource/ancestorMetaData' +import { eventBus } from 'web-pkg/src/services/eventBus' const allowSharePermissions = (getters) => { return ( @@ -147,6 +148,9 @@ export default { field: 'starred', value: newValue }) + if (!newValue) { + eventBus.publish('app.files.list.removeFromFavorites') + } }) .catch((error) => { throw new Error(error) diff --git a/packages/web-app-files/src/views/Favorites.vue b/packages/web-app-files/src/views/Favorites.vue index 9c36c6681d3..abee020cf7e 100644 --- a/packages/web-app-files/src/views/Favorites.vue +++ b/packages/web-app-files/src/views/Favorites.vue @@ -88,6 +88,7 @@ import FilesViewWrapper from '../components/FilesViewWrapper.vue' import { useStore } from 'web-pkg/src/composables' import { SpaceResource } from 'web-client/src/helpers' import { getSpaceFromResource } from 'web-app-files/src/helpers/resource/getSpace' +import { eventBus } from 'web-pkg/src/services/eventBus' const visibilityObserver = new VisibilityObserver() @@ -117,11 +118,14 @@ export default defineComponent({ ViewModeConstants.tilesView ]) + let loadResourcesEventToken + return { ...useFileActions(), ...useResourcesViewDefaults(), getSpace, - viewModes + viewModes, + loadResourcesEventToken } }, @@ -141,12 +145,18 @@ export default defineComponent({ }, async created() { - await this.loadResourcesTask.perform() - this.scrollToResourceFromRoute(this.paginatedResources) + this.loadResourcesEventToken = await eventBus.subscribe( + 'app.files.list.removeFromFavorites', + async () => { + await this.loadResourcesTask.perform() + this.scrollToResourceFromRoute(this.paginatedResources) + } + ) }, beforeUnmount() { visibilityObserver.disconnect() + eventBus.unsubscribe('app.files.list.removeFromFavorites', this.loadResourcesEventToken) }, methods: { From ad82729218074507a9285aac3195f512ad801fd0 Mon Sep 17 00:00:00 2001 From: elizavetaRa Date: Mon, 22 May 2023 16:18:16 +0200 Subject: [PATCH 2/2] add changelog --- changelog/unreleased/bugfix-favorites-list-update-on-removal | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/bugfix-favorites-list-update-on-removal diff --git a/changelog/unreleased/bugfix-favorites-list-update-on-removal b/changelog/unreleased/bugfix-favorites-list-update-on-removal new file mode 100644 index 00000000000..93df6521b8a --- /dev/null +++ b/changelog/unreleased/bugfix-favorites-list-update-on-removal @@ -0,0 +1,5 @@ +Bugfix: Favorites list update on removal + +The Favorites list is now updating when a resource is removed from the list in this view + +https://github.com/owncloud/web/pull/9078