mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
feat(editor): Show Collaboration pane only when there are multiple active users (#10772)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
This commit is contained in:
parent
755188897b
commit
a0af1d9a06
|
@ -18,6 +18,8 @@ watch(visibility, (visibilityState) => {
|
|||
}
|
||||
});
|
||||
|
||||
const showUserStack = computed(() => collaborationStore.collaborators.length > 1);
|
||||
|
||||
const collaboratorsSorted = computed(() => {
|
||||
const currentWorkflowUsers = collaborationStore.collaborators.map(({ user }) => user);
|
||||
const owner = currentWorkflowUsers.find(isUserGlobalOwner);
|
||||
|
@ -44,7 +46,11 @@ onBeforeUnmount(() => {
|
|||
:class="`collaboration-pane-container ${$style.container}`"
|
||||
data-test-id="collaboration-pane"
|
||||
>
|
||||
<n8n-user-stack :users="collaboratorsSorted" :current-user-email="currentUserEmail" />
|
||||
<n8n-user-stack
|
||||
v-if="showUserStack"
|
||||
:users="collaboratorsSorted"
|
||||
:current-user-email="currentUserEmail"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -668,7 +668,7 @@ function showCreateWorkflowSuccessToast(id?: string) {
|
|||
</span>
|
||||
<EnterpriseEdition :features="[EnterpriseEditionFeature.Sharing]">
|
||||
<div :class="$style.group">
|
||||
<CollaborationPane v-if="nodeViewVersion === '2' && !isNewWorkflow" />
|
||||
<CollaborationPane v-if="!isNewWorkflow" />
|
||||
<N8nButton
|
||||
type="secondary"
|
||||
data-test-id="workflow-share-button"
|
||||
|
|
|
@ -96,4 +96,22 @@ describe('CollaborationPane', () => {
|
|||
// Owner is second in the store but should be rendered first
|
||||
expect(firstAvatar).toHaveAttribute('data-test-id', `user-stack-avatar-${OWNER_USER.id}`);
|
||||
});
|
||||
|
||||
it('should not render the user-stack if there is only one user', async () => {
|
||||
const { getByTestId } = renderComponent({
|
||||
pinia: createTestingPinia({
|
||||
initialState: {
|
||||
...initialState,
|
||||
[STORES.COLLABORATION]: {
|
||||
collaborators: [{ lastSeen: '2023-11-22T10:17:12.246Z', user: OWNER_USER }],
|
||||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
await waitAllPromises();
|
||||
|
||||
const collaborationPane = getByTestId('collaboration-pane');
|
||||
expect(collaborationPane).toBeInTheDocument();
|
||||
expect(collaborationPane.querySelector('[data-test-id=user-stack-avatars]')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue