Skip to content

Commit cdaa405

Browse files
committed
🐛 Add placeholder for non-existent alias. Fixes #202
1 parent 0dd602e commit cdaa405

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

haus-keeper/src/main/java/org/commonhaus/automation/hk/forwardemail/ForwardEmailService.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ Map<AliasKey, Alias> fetchAliases(Set<AliasKey> emails) {
6464
aliases.put(key, alias);
6565
} catch (WebApplicationException e) {
6666
if (e.getResponse().getStatus() == 404) {
67-
Log.debugf("getAliases: Alias not found: %s", key);
67+
Log.debugf("getAliases: Alias not found: %s, creating placeholder", key);
68+
// Create a placeholder alias so the frontend can display the input form
69+
Alias placeholder = key.toAlias();
70+
aliases.put(key, placeholder);
6871
continue;
6972
}
7073
throw e;
@@ -199,7 +202,8 @@ protected Alias putAlias(@Nonnull AliasKey aliasKey, @Nonnull String description
199202
}
200203

201204
Alias alias = existing;
202-
if (alias == null) {
205+
if (alias == null || alias.id == null) {
206+
// Create a new alias if no existing alias or if it's a placeholder without an id
203207
alias = aliasKey.toAlias();
204208
alias.description = description;
205209
alias.recipients = recipients;

haus-keeper/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ quarkus.rest-client.logging.body-limit=50
8383

8484
## Rest API for membership management
8585

86-
quarkus.http.cors=true
86+
quarkus.http.cors.enabled=true
8787
quarkus.http.cors.methods=GET,PUT,POST
8888
quarkus.http.cors.origins=https://www.commonhaus.org,https://haus-keeper.commonhaus.org
8989

0 commit comments

Comments
 (0)