feat(editor): Add correct credential owner contact details for readonly credentials (#5208)

* feat: add correct credential owner contact details for readonly credentials

* chore: remove unnecessary translation

* fix: update credential owner name to be retrieved using usedCredentials

* fix: correct credentialownername getter typing
This commit is contained in:
Alex Grozav
2023-02-14 16:13:22 +02:00
committed by GitHub
parent 246189f6da
commit 36108f82a1
6 changed files with 54 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
import { INodeUi } from './../Interface';
import { INodeUi, IUsedCredential } from './../Interface';
import {
createNewCredential,
deleteCredential,
@@ -177,13 +177,19 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, {
};
},
getCredentialOwnerName() {
return (credentialId: string): string => {
const credential = this.getCredentialById(credentialId);
return credential && credential.ownedBy && credential.ownedBy.firstName
return (credential: ICredentialsResponse | IUsedCredential | undefined): string => {
return credential?.ownedBy?.firstName
? `${credential.ownedBy.firstName} ${credential.ownedBy.lastName} (${credential.ownedBy.email})`
: i18n.baseText('credentialEdit.credentialSharing.info.sharee.fallback');
};
},
getCredentialOwnerNameById() {
return (credentialId: string): string => {
const credential = this.getCredentialById(credentialId);
return this.getCredentialOwnerName(credential);
};
},
},
actions: {
setCredentialTypes(credentialTypes: ICredentialType[]): void {