[PR #4368] [MERGED] feat: extend duplicate collection to personal workspace in SH #4772

Closed
opened 2026-03-17 02:16:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4368
Author: @jamesgeorge007
Created: 9/20/2024
Status: Merged
Merged: 9/30/2024
Merged by: @jamesgeorge007

Base: nextHead: feat/extend-duplicate-collection-sh


📝 Commits (2)

  • 2a01a87 feat: extend duplicate collection to personal workspace in SH
  • a42d886 chore: sync collection platform definitions to sh-desktop

📊 Changes

12 files changed (+604 additions, -275 deletions)

View changed files

📝 packages/hoppscotch-common/src/components/collections/Collection.vue (+1 -21)
📝 packages/hoppscotch-common/src/components/collections/graphql/Collection.vue (+1 -17)
📝 packages/hoppscotch-common/src/components/collections/graphql/Folder.vue (+1 -17)
📝 packages/hoppscotch-common/src/platform/index.ts (+0 -6)
📝 packages/hoppscotch-selfhost-desktop/src/api/subscriptions/UserCollectionCreated.graphql (+1 -0)
packages/hoppscotch-selfhost-desktop/src/api/subscriptions/UserCollectionDuplicated.graphql (+15 -0)
📝 packages/hoppscotch-selfhost-desktop/src/platform/collections/collections.api.ts (+49 -42)
📝 packages/hoppscotch-selfhost-desktop/src/platform/collections/collections.platform.ts (+298 -38)
packages/hoppscotch-selfhost-web/src/api/subscriptions/userCollectionDuplicated.graphql (+15 -0)
📝 packages/hoppscotch-selfhost-web/src/main.ts (+0 -1)
📝 packages/hoppscotch-selfhost-web/src/platform/collections/collections.api.ts (+7 -0)
📝 packages/hoppscotch-selfhost-web/src/platform/collections/collections.platform.ts (+216 -133)

📄 Description

This PR extends the ability to duplicate REST/GQL collection under personal workspace in SH as a follow-up of #4211. The BE requirement regarding the addition of a dedicated GQL subscription for duplication action is added in #4358.

Closes HFE-596.

What's changed

  • Add UserCollecitionDuplicated GQL subscription document.
  • Remove the duplicateCollectionDisabledInPersonalWorkspace temporary feature flag and enable duplicate collection action under personal workspace in SH.
  • Additions to the syncing context ~/collections.platform.ts accounting for the new GQL subscription:
    • For an incoming root collection from the subscription, remove the existing collection in store matching the id ending with the -duplicate suffix and add the above entry where relevant transformations are applied to construct folders & requests fields.
    • Similarly, for an incoming child collection, remove the existing collection in store, add a new child collection and perform an edit with the relevant entries.
    • New transformDuplicatedCollections() & transformDuplicatedRequests() helper functions to apply necessary transformations on the data received via the subscriptions converting them to the respective internal representations.
    • Remove issueBackendIDToDuplicatedCollection() helper function.
  • Sync platform definitions wrt collections from selfhost-web to sh-desktop.

Note to reviewers

Please ensure to rebuild the BE container accounting for the GQL subscription addition and verify the following flows:

  • Set Authorization/headers at the collection level and they are retained in the duplicated collection.
  • Importing from other sources (Postman, Insomnia, etc) and verifying the duplicate behaviour.
  • Actions performed over the children under the newly created collection aren't reflected in the source collection and are preserved.

There's a pre-existing issue in GraphQL where duplicating a collection and updating the Authorization/header properties set at the collection level reflects in the original collection and vice versa, tracked in HFE-600.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/4368 **Author:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Created:** 9/20/2024 **Status:** ✅ Merged **Merged:** 9/30/2024 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `next` ← **Head:** `feat/extend-duplicate-collection-sh` --- ### 📝 Commits (2) - [`2a01a87`](https://github.com/hoppscotch/hoppscotch/commit/2a01a87dc90435a1f934091345687251b1c16edf) feat: extend duplicate collection to personal workspace in SH - [`a42d886`](https://github.com/hoppscotch/hoppscotch/commit/a42d88683468e54600c136beddb4e63c026b3f55) chore: sync collection platform definitions to `sh-desktop` ### 📊 Changes **12 files changed** (+604 additions, -275 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components/collections/Collection.vue` (+1 -21) 📝 `packages/hoppscotch-common/src/components/collections/graphql/Collection.vue` (+1 -17) 📝 `packages/hoppscotch-common/src/components/collections/graphql/Folder.vue` (+1 -17) 📝 `packages/hoppscotch-common/src/platform/index.ts` (+0 -6) 📝 `packages/hoppscotch-selfhost-desktop/src/api/subscriptions/UserCollectionCreated.graphql` (+1 -0) ➕ `packages/hoppscotch-selfhost-desktop/src/api/subscriptions/UserCollectionDuplicated.graphql` (+15 -0) 📝 `packages/hoppscotch-selfhost-desktop/src/platform/collections/collections.api.ts` (+49 -42) 📝 `packages/hoppscotch-selfhost-desktop/src/platform/collections/collections.platform.ts` (+298 -38) ➕ `packages/hoppscotch-selfhost-web/src/api/subscriptions/userCollectionDuplicated.graphql` (+15 -0) 📝 `packages/hoppscotch-selfhost-web/src/main.ts` (+0 -1) 📝 `packages/hoppscotch-selfhost-web/src/platform/collections/collections.api.ts` (+7 -0) 📝 `packages/hoppscotch-selfhost-web/src/platform/collections/collections.platform.ts` (+216 -133) </details> ### 📄 Description This PR extends the ability to duplicate REST/GQL collection under personal workspace in SH as a follow-up of #4211. The BE requirement regarding the addition of a dedicated GQL subscription for duplication action is added in #4358. Closes HFE-596. ### What's changed - Add `UserCollecitionDuplicated` GQL subscription document. - Remove the `duplicateCollectionDisabledInPersonalWorkspace` temporary feature flag and enable duplicate collection action under personal workspace in SH. - Additions to the syncing context `~/collections.platform.ts` accounting for the new GQL subscription: - For an incoming root collection from the subscription, remove the existing collection in store matching the `id` ending with the `-duplicate` suffix and add the above entry where relevant transformations are applied to construct `folders` & `requests` fields. - Similarly, for an incoming child collection, remove the existing collection in store, add a new child collection and perform an edit with the relevant entries. - New `transformDuplicatedCollections()` & `transformDuplicatedRequests()` helper functions to apply necessary transformations on the data received via the subscriptions converting them to the respective internal representations. - Remove `issueBackendIDToDuplicatedCollection()` helper function. - Sync platform definitions wrt collections from `selfhost-web` to `sh-desktop`. ### Note to reviewers Please ensure to rebuild the BE container accounting for the GQL subscription addition and verify the following flows: - Set `Authorization/headers` at the collection level and they are retained in the duplicated collection. - Importing from other sources (Postman, Insomnia, etc) and verifying the duplicate behaviour. - Actions performed over the children under the newly created collection aren't reflected in the source collection and are preserved. > There's a pre-existing issue in GraphQL where duplicating a collection and updating the `Authorization/header` properties set at the collection level reflects in the original collection and vice versa, tracked in [HFE-600](https://linear.app/hoppscotch/issue/HFE-600/collection-level-properties-set-for-graphql-child-collections-from-the). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:16:45 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4772
No description provided.