style: 💄 Update if curly brace statements (#3023)

This commit is contained in:
Zhihe Li authored and GitHub committed 2025-10-13 10:53:21 -04:00
1 parent bf134072e5
commit 35ccaeba56
24 files changed
+51 -27

No files matched your search

+2 -1
View File
@@ -59,10 +59,11 @@ export default class RoleAbility extends ModelAbility {
const type = this.model.constructor.modelName;
const typeIsValid =
type === 'user' || type === 'group' || type === 'managed-group';
if (!typeIsValid)
if (!typeIsValid) {
throw new InvalidRolePrincipalTypeError(
`Expected a role principal of type 'user', 'group', or 'managed-group'. Got '${type}'.`,
);
}
return this.can.can(`read ${type}`, this.model);
}
}
+2 -1
View File
@@ -98,8 +98,9 @@ export default class AccountSerializer extends ApplicationSerializer {
serialized.attributes = {};
}
// New record case
if (password && snapshot?.record?.isNew)
if (password && snapshot?.record?.isNew) {
serialized.attributes.password = password;
}
// Set password custom method
if (snapshot?.adapterOptions?.method === 'set-password') {
serialized = this.serializeForSetPassword(snapshot, password);
@@ -28,8 +28,9 @@ export default class CredentialStoreSerializer extends ApplicationSerializer {
if (
!serialized.attributes?.client_certificate_key &&
serialized.attributes?.client_certificate
)
) {
delete serialized.attributes.client_certificate_key;
}
}
return serialized;
}
@@ -76,9 +76,10 @@ export default class StorageBucketSerializer extends ApplicationSerializer {
// This deletes any fields that don't belong to the record's credential type
if (options.isNestedAttribute && json.attributes) {
// The key must be included in the fieldsByType list above
if (!fieldsByCredentialType[credentialType].includes(key))
if (!fieldsByCredentialType[credentialType].includes(key)) {
// API requires these fields to be null
json.attributes[key] = null;
}
}
//json.secrets is only present, if there are any updates to the secret fields
+4 -2
View File
@@ -33,16 +33,18 @@ export default class TargetSerializer extends ApplicationSerializer {
const injectedApplicationCredentialSourceIDs =
snapshot?.adapterOptions?.injectedApplicationCredentialSourceIDs;
if (brokeredCredentialSourceIDs)
if (brokeredCredentialSourceIDs) {
serialized = this.serializeWithBrokeredCredentialSources(
snapshot,
brokeredCredentialSourceIDs,
);
if (injectedApplicationCredentialSourceIDs)
}
if (injectedApplicationCredentialSourceIDs) {
serialized = this.serializeWithInjectedApplicationCredentialSources(
snapshot,
injectedApplicationCredentialSourceIDs,
);
}
if (isNew && serialized?.with_aliases) {
// API expects scope id along with every alias value
+2 -1
View File
@@ -18,8 +18,9 @@ export default class UserSerializer extends ApplicationSerializer {
serialize(snapshot) {
let serialized = super.serialize(...arguments);
const accountIDs = snapshot?.adapterOptions?.accountIDs;
if (accountIDs)
if (accountIDs) {
serialized = this.serializewithAccounts(snapshot, accountIDs);
}
return serialized;
}