Skip to content

Commit

Permalink
Fix condition to show the warning after workflow activation for free …
Browse files Browse the repository at this point in the history
…ai credits
  • Loading branch information
RicardoE105 committed Jan 8, 2025
1 parent 88c0838 commit cbe9de8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/editor-ui/src/components/WorkflowActivator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ describe('WorkflowActivator', () => {
it('Should show warning toast if the workflow to be activated has free OpenAI credentials', async () => {
const toast = useToast();

mockWorkflowsStore.workflow.usedCredentials = [
{
mockWorkflowsStore.usedCredentials = {
'1': {
id: '1',
name: '',
credentialType: '',
currentUserHasAccess: false,
},
];
};

mockCredentialsStore.state.credentials = {
'1': {
Expand Down
5 changes: 2 additions & 3 deletions packages/editor-ui/src/components/WorkflowActivator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ const disabled = computed((): boolean => {
const currentWorkflowHasFreeAiCredits = computed((): boolean => {
if (!workflowsStore?.workflow?.usedCredentials) return false;
return workflowsStore.workflow.usedCredentials.some(
(usedCredential: IUsedCredential) =>
credentialsStore.state.credentials[usedCredential.id].isManaged,
return Object.keys(workflowsStore.usedCredentials).some(
(id: string) => credentialsStore.state.credentials[id].isManaged,
);
});
Expand Down

0 comments on commit cbe9de8

Please sign in to comment.