Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,18 @@ default void listAddressesShouldContainUserAddressAndAnAliasOfTheDomainUserFromA
redirectDomain(OTHER_DOMAIN).to(DOMAIN);
redirectUser(userAliasOtherDomain).to(USER);

Username userAliasMainDomain = USER_ALIAS.withOtherDomain(DOMAIN);
Username userOtherDomain = USER.withOtherDomain(OTHER_DOMAIN);
assertThat(Flux.from(aliasReverseResolver().listAddresses(USER)).toStream())
.containsExactlyInAnyOrder(USER.asMailAddress(), userAliasOtherDomain.asMailAddress(), userAliasMainDomain.asMailAddress(), userOtherDomain.asMailAddress());
.containsExactlyInAnyOrder(USER.asMailAddress(), userAliasOtherDomain.asMailAddress(), userOtherDomain.asMailAddress());
}

@Test
default void listAddressesShouldNotStampAliasLocalPartOntoUserDomainWhenNoDomainAlias() throws Exception {
Username userAliasOtherDomain = USER_ALIAS.withOtherDomain(OTHER_DOMAIN);
redirectUser(userAliasOtherDomain).to(USER);

assertThat(Flux.from(aliasReverseResolver().listAddresses(USER)).toStream())
.containsExactlyInAnyOrder(USER.asMailAddress(), userAliasOtherDomain.asMailAddress());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,18 @@ default void allValidFromAddressesShouldContainUserAddressAndAnAliasOfTheDomainU
redirectDomain(OTHER_DOMAIN).to(DOMAIN).asAlias();
redirectUser(userAliasOtherDomain).to(USER);

Username userAliasMainDomain = USER_ALIAS.withOtherDomain(DOMAIN);
Username userOtherDomain = USER.withOtherDomain(OTHER_DOMAIN);
assertThat(Flux.from(canSendFrom().allValidFromAddressesForUser(USER)).toStream())
.containsExactlyInAnyOrder(USER.asMailAddress(), userAliasOtherDomain.asMailAddress(), userAliasMainDomain.asMailAddress(), userOtherDomain.asMailAddress());
.containsExactlyInAnyOrder(USER.asMailAddress(), userAliasOtherDomain.asMailAddress(), userOtherDomain.asMailAddress());
}

@Test
default void allValidFromAddressesShouldNotStampAliasLocalPartOntoUserDomainWhenNoDomainAlias() throws Exception {
Username userAliasOtherDomain = USER_ALIAS.withOtherDomain(OTHER_DOMAIN);
redirectUser(userAliasOtherDomain).to(USER);

assertThat(Flux.from(canSendFrom().allValidFromAddressesForUser(USER)).toStream())
.containsExactlyInAnyOrder(USER.asMailAddress(), userAliasOtherDomain.asMailAddress());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Flux<MailAddress> listAddresses(Username user) {
CanSendFromImpl.DomainFetcher domains = domainFetcher();

return relatedAliases(user)
.flatMap(allowedUser -> user.getDomainPart()
.flatMap(allowedUser -> allowedUser.getDomainPart()
.map(domain -> Flux.concat(
Flux.just(allowedUser),
domains.fetch(domain).map(allowedUser::withOtherDomain)))
Expand Down