From a7320535e97173ee30f594a4950fe7cda80c8e8e Mon Sep 17 00:00:00 2001 From: mbliznikova Date: Thu, 30 Nov 2023 00:19:04 +0000 Subject: [PATCH 1/2] #4791 Invalidate cache after adding a collection item for data consistency --- app/Http/Controllers/CollectionController.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/Http/Controllers/CollectionController.php b/app/Http/Controllers/CollectionController.php index 6cd4bda57..15e4737e0 100644 --- a/app/Http/Controllers/CollectionController.php +++ b/app/Http/Controllers/CollectionController.php @@ -166,11 +166,7 @@ class CollectionController extends Controller 'order' => $count, ]); - CollectionService::addItem( - $collection->id, - $status->id, - $count - ); + CollectionService::deleteCollection($collection->id); $collection->updated_at = now(); $collection->save(); From 7cb075dbf9fcbab77e021782cf01d8415f8084dc Mon Sep 17 00:00:00 2001 From: mbliznikova Date: Thu, 30 Nov 2023 00:20:08 +0000 Subject: [PATCH 2/2] #4790 User experience: add a post to a collection just right after deleting it from there --- resources/assets/js/components/CollectionComponent.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/assets/js/components/CollectionComponent.vue b/resources/assets/js/components/CollectionComponent.vue index 3f77cfc13..36e0050da 100644 --- a/resources/assets/js/components/CollectionComponent.vue +++ b/resources/assets/js/components/CollectionComponent.vue @@ -619,6 +619,9 @@ export default { this.posts = this.posts.filter(post => { return post.id != id; }); + this.ids = this.ids.filter(post_id => { + return post_id != id; + }); }, addRecentId(post) { @@ -630,6 +633,7 @@ export default { // window.location.reload(); this.closeModals(); this.posts.push(res.data); + this.ids.push(post.id); this.collection.post_count++; }).catch(err => { swal('Oops!', 'An error occured, please try selecting another post.', 'error');