adj: prevent deleting non-managed addresses
This commit is contained in:
parent
a2d344ceb4
commit
76f1c43858
@ -125,9 +125,12 @@ export class AliasesService<ServiceParams extends AliasesParams = AliasesParams>
|
|||||||
}
|
}
|
||||||
|
|
||||||
sanitizeAliasResponse(alias: WildDuckAddress): AliasApiResponse {
|
sanitizeAliasResponse(alias: WildDuckAddress): AliasApiResponse {
|
||||||
|
// Prevent the user from deleting their main address or any address that does not end with the preferred domain
|
||||||
|
const isRemovable = !alias.main && alias.address.endsWith(config.get('wildDuck.domain'));
|
||||||
|
|
||||||
// Hide the id if the alias is not removable
|
// Hide the id if the alias is not removable
|
||||||
return {
|
return {
|
||||||
id: alias.main ? null : alias.id,
|
id: isRemovable ? alias.id : null,
|
||||||
address: alias.address,
|
address: alias.address,
|
||||||
tags: alias.tags,
|
tags: alias.tags,
|
||||||
created: alias.created,
|
created: alias.created,
|
||||||
|
Loading…
Reference in New Issue
Block a user