From a4e88b0139dc51370c65d811ca1654b7344e9fac Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 10 Sep 2020 16:16:29 +0200 Subject: [PATCH 1/7] Update web and messages --- bubble-server/src/main/resources/messages | 2 +- bubble-web | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bubble-server/src/main/resources/messages b/bubble-server/src/main/resources/messages index 74c7c7f2..9d190c2f 160000 --- a/bubble-server/src/main/resources/messages +++ b/bubble-server/src/main/resources/messages @@ -1 +1 @@ -Subproject commit 74c7c7f2efa41dd12d74cffff5013149136d3867 +Subproject commit 9d190c2f2d947ecde52a56876ea7867301c4e34d diff --git a/bubble-web b/bubble-web index 2d0df5ec..9cb62ef5 160000 --- a/bubble-web +++ b/bubble-web @@ -1 +1 @@ -Subproject commit 2d0df5ecd846bc81f72d37ec385ed8b46ae17fd9 +Subproject commit 9cb62ef5aff76b9129f2232f03ad41ebb40cc7b1 -- 2.17.1 From dd487995ac1fe134efbba34bae642e1be610c165 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 10 Sep 2020 16:16:56 +0200 Subject: [PATCH 2/7] Try to fix timing of delete confirmation notice sent out --- .../bubble/service/account/StandardAccountMessageService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java b/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java index c6564958..b2a0ad37 100644 --- a/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java +++ b/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java @@ -140,11 +140,12 @@ public class StandardAccountMessageService implements AccountMessageService { final AccountMessage request = messageDAO.findOperationRequest(approval); if (request == null) throw invalidEx("err.approvalToken.invalid", "Request could not be found for approval: "+approval); final AccountPolicy policy = policyDAO.findSingleByAccount(account.getUuid()); - final AccountMessage confirm = messageDAO.create(new AccountMessage(approval).setMessageType(AccountMessageType.confirmation)); approval.setRequest(request); approval.setRequestContact(policy.findContactByUuid(approval.getRequest().getContact())); getCompletionHandler(approval).confirm(approval, data); + final AccountMessage confirm = messageDAO.create( + new AccountMessage(approval).setMessageType(AccountMessageType.confirmation)); if (approval.hasConfirmationTokensToRemove()) { final RedisService tokens = getConfirmationTokens(); for (String toRemove : approval.getConfirmationTokensToRemove()) tokens.del(toRemove); -- 2.17.1 From 1b295b6be8a69d090ac474213590fe8d47e0d3d4 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 10 Sep 2020 20:21:30 +0200 Subject: [PATCH 3/7] Fix account's refs deletion on account delete --- .../src/main/java/bubble/dao/account/AccountDAO.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java b/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java index 2a56ea38..cee76ac4 100644 --- a/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java +++ b/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java @@ -13,6 +13,7 @@ import bubble.dao.bill.AccountPaymentArchivedDAO; import bubble.dao.bill.BillDAO; import bubble.dao.cloud.BubbleDomainDAO; import bubble.dao.cloud.BubbleFootprintDAO; +import bubble.dao.cloud.BubbleNetworkDAO; import bubble.dao.cloud.CloudServiceDAO; import bubble.dao.device.DeviceDAO; import bubble.model.account.*; @@ -410,6 +411,10 @@ public class AccountDAO extends AbstractCRUDDAO implements SqlViewSearc configuration.getBean(AccountPaymentArchivedDAO.class).createForAccount(account); log.info("delete: starting to delete account-dependent objects - " + currentThread().getName()); + final BubbleNetworkDAO networkDAO = configuration.getBean(BubbleNetworkDAO.class); + final List networks = networkDAO.findByAccount(account.getUuid()); + networks.forEach(n -> networkDAO.delete(n.getUuid())); // deleting all networks dependency objects + configuration.deleteDependencies(account); log.info("delete: finished deleting account-dependent objects - " + currentThread().getName()); -- 2.17.1 From 14ddc87eab10e237d2faba19d58099bdeae9ec3e Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 17 Sep 2020 11:01:13 +0200 Subject: [PATCH 4/7] Move welcome account template to requests --- .../java/bubble/dao/account/AccountInitializer.java | 2 +- .../dao/account/message/AccountMessageDAO.java | 12 ------------ .../java/bubble/model/account/AccountContact.java | 2 +- .../bubble/model/account/message/AccountMessage.java | 4 ++-- bubble-server/src/main/resources/messages | 2 +- .../test/resources/models/include/new_account.json | 2 +- .../resources/models/include/referral_signup.json | 4 ++-- .../resources/models/tests/payment/pay_credit.json | 4 ++-- .../tests/payment/pay_credit_refund_and_restart.json | 4 ++-- .../models/tests/payment/recurring_billing.json | 4 ++-- .../resources/models/tests/promo/account_credit.json | 4 ++-- .../models/tests/promo/first_month_free.json | 4 ++-- .../resources/models/tests/promo/multi_promo.json | 4 ++-- .../models/tests/promo/referral_month_free.json | 8 ++++---- 14 files changed, 24 insertions(+), 36 deletions(-) diff --git a/bubble-server/src/main/java/bubble/dao/account/AccountInitializer.java b/bubble-server/src/main/java/bubble/dao/account/AccountInitializer.java index 1c14e988..a9d7ad99 100644 --- a/bubble-server/src/main/java/bubble/dao/account/AccountInitializer.java +++ b/bubble-server/src/main/java/bubble/dao/account/AccountInitializer.java @@ -99,7 +99,7 @@ public class AccountInitializer implements Runnable { .setAccount(accountUuid) .setName(accountUuid) .setNetwork(thisNetwork.getUuid()) - .setMessageType(AccountMessageType.notice) + .setMessageType(AccountMessageType.request) .setAction(AccountAction.welcome) .setTarget(ActionTarget.account) .setContact(contact)); diff --git a/bubble-server/src/main/java/bubble/dao/account/message/AccountMessageDAO.java b/bubble-server/src/main/java/bubble/dao/account/message/AccountMessageDAO.java index c5442061..76a66cc7 100644 --- a/bubble-server/src/main/java/bubble/dao/account/message/AccountMessageDAO.java +++ b/bubble-server/src/main/java/bubble/dao/account/message/AccountMessageDAO.java @@ -166,9 +166,6 @@ public class AccountMessageDAO extends AccountOwnedEntityDAO { } public AccountMessage findOperationRequest(AccountMessage basis) { - if (basis.getAction() == AccountAction.welcome && basis.getTarget() == ActionTarget.account) { - return findWelcomeNotice(basis); - } return findByUniqueFields("account", basis.getAccount(), "name", basis.getName(), "requestId", basis.getRequestId(), @@ -177,15 +174,6 @@ public class AccountMessageDAO extends AccountOwnedEntityDAO { "target", basis.getTarget()); } - public AccountMessage findWelcomeNotice(AccountMessage basis) { - return findByUniqueFields("account", basis.getAccount(), - "name", basis.getName(), - "requestId", basis.getRequestId(), - "messageType", AccountMessageType.notice, - "action", AccountAction.welcome, - "target", ActionTarget.account); - } - public List findOperationDenials(AccountMessage basis) { if (basis == null) { return Collections.emptyList(); diff --git a/bubble-server/src/main/java/bubble/model/account/AccountContact.java b/bubble-server/src/main/java/bubble/model/account/AccountContact.java index df97cd13..5cc2e0af 100644 --- a/bubble-server/src/main/java/bubble/model/account/AccountContact.java +++ b/bubble-server/src/main/java/bubble/model/account/AccountContact.java @@ -208,7 +208,7 @@ public class AccountContact implements Serializable { if (!verified()) { if ( target == ActionTarget.account && ( (action == AccountAction.verify) // all verification-related messages are allowed to unverified - || (type == AccountMessageType.notice && action == AccountAction.welcome) // welcome is allowed to unverified + || (type == AccountMessageType.request && action == AccountAction.welcome) // welcome is allowed to unverified ) ) { log.info("isAllowed(" + message.getAction() + "): allowing "+type+" message to unverified contact: "+action); } else { diff --git a/bubble-server/src/main/java/bubble/model/account/message/AccountMessage.java b/bubble-server/src/main/java/bubble/model/account/message/AccountMessage.java index 60deb681..2bb184c5 100644 --- a/bubble-server/src/main/java/bubble/model/account/message/AccountMessage.java +++ b/bubble-server/src/main/java/bubble/model/account/message/AccountMessage.java @@ -97,8 +97,8 @@ public class AccountMessage extends IdentifiableBase implements HasAccount { public String templateName(String basename) { return getMessageType()+"/"+ getAction()+"/"+getTarget()+"/"+basename+".hbs"; } public long tokenTimeoutSeconds(AccountPolicy policy) { - // only requests and welcome message get tokens (welcome messages also verify the initial email address) - if (getMessageType() == AccountMessageType.request || (getMessageType() == AccountMessageType.notice && getAction() == AccountAction.welcome)) { + if (getMessageType() == AccountMessageType.request) { + // only requests get tokens switch (getTarget()) { case account: return policy.getAccountOperationTimeout()/1000; case network: return policy.getNodeOperationTimeout()/1000; diff --git a/bubble-server/src/main/resources/messages b/bubble-server/src/main/resources/messages index 04db2238..6767812d 160000 --- a/bubble-server/src/main/resources/messages +++ b/bubble-server/src/main/resources/messages @@ -1 +1 @@ -Subproject commit 04db22382ddffa08b3f05c024603da75cdfb8b55 +Subproject commit 6767812db299ffb810c8d88586a6462c670bfda7 diff --git a/bubble-server/src/test/resources/models/include/new_account.json b/bubble-server/src/test/resources/models/include/new_account.json index 7d34c4b4..f04c4fd9 100644 --- a/bubble-server/src/test/resources/models/include/new_account.json +++ b/bubble-server/src/test/resources/models/include/new_account.json @@ -41,7 +41,7 @@ "store": "userInbox", "check": [ {"condition": "json.length == 1"}, - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] diff --git a/bubble-server/src/test/resources/models/include/referral_signup.json b/bubble-server/src/test/resources/models/include/referral_signup.json index 82804b45..beebc188 100644 --- a/bubble-server/src/test/resources/models/include/referral_signup.json +++ b/bubble-server/src/test/resources/models/include/referral_signup.json @@ -37,12 +37,12 @@ "comment": "as root, check email inbox for welcome message", "request": { "session": "<>", - "uri": "debug/inbox/email/<>@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/<>@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] diff --git a/bubble-server/src/test/resources/models/tests/payment/pay_credit.json b/bubble-server/src/test/resources/models/tests/payment/pay_credit.json index 87a5342d..53b8dd46 100644 --- a/bubble-server/src/test/resources/models/tests/payment/pay_credit.json +++ b/bubble-server/src/test/resources/models/tests/payment/pay_credit.json @@ -105,12 +105,12 @@ "comment": "as root, check email inbox for welcome message", "request": { "session": "rootSession", - "uri": "debug/inbox/email/test_user_credit@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/test_user_credit@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] diff --git a/bubble-server/src/test/resources/models/tests/payment/pay_credit_refund_and_restart.json b/bubble-server/src/test/resources/models/tests/payment/pay_credit_refund_and_restart.json index 9b555d9b..1ccd55d6 100644 --- a/bubble-server/src/test/resources/models/tests/payment/pay_credit_refund_and_restart.json +++ b/bubble-server/src/test/resources/models/tests/payment/pay_credit_refund_and_restart.json @@ -44,12 +44,12 @@ "comment": "as root, check email inbox for welcome message", "request": { "session": "rootSession", - "uri": "debug/inbox/email/test_user_credit_refund_restart@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/test_user_credit_refund_restart@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] diff --git a/bubble-server/src/test/resources/models/tests/payment/recurring_billing.json b/bubble-server/src/test/resources/models/tests/payment/recurring_billing.json index c02106a6..9285c2e6 100644 --- a/bubble-server/src/test/resources/models/tests/payment/recurring_billing.json +++ b/bubble-server/src/test/resources/models/tests/payment/recurring_billing.json @@ -44,12 +44,12 @@ "comment": "as root, check email inbox for welcome message", "request": { "session": "rootSession", - "uri": "debug/inbox/email/test_user_recurring@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/test_user_recurring@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] diff --git a/bubble-server/src/test/resources/models/tests/promo/account_credit.json b/bubble-server/src/test/resources/models/tests/promo/account_credit.json index f6bb8f80..569881f7 100644 --- a/bubble-server/src/test/resources/models/tests/promo/account_credit.json +++ b/bubble-server/src/test/resources/models/tests/promo/account_credit.json @@ -22,12 +22,12 @@ "comment": "root: check email inbox for welcome message", "request": { "session": "rootSession", - "uri": "debug/inbox/email/account_credit_user@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/account_credit_user@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] diff --git a/bubble-server/src/test/resources/models/tests/promo/first_month_free.json b/bubble-server/src/test/resources/models/tests/promo/first_month_free.json index 45605c5f..d76224d9 100644 --- a/bubble-server/src/test/resources/models/tests/promo/first_month_free.json +++ b/bubble-server/src/test/resources/models/tests/promo/first_month_free.json @@ -22,12 +22,12 @@ "comment": "as root, check email inbox for welcome message", "request": { "session": "rootSession", - "uri": "debug/inbox/email/test_user_1mo_free@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/test_user_1mo_free@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] diff --git a/bubble-server/src/test/resources/models/tests/promo/multi_promo.json b/bubble-server/src/test/resources/models/tests/promo/multi_promo.json index da3456b9..b3ca71b8 100644 --- a/bubble-server/src/test/resources/models/tests/promo/multi_promo.json +++ b/bubble-server/src/test/resources/models/tests/promo/multi_promo.json @@ -50,12 +50,12 @@ "comment": "root: check email inbox for welcome message for referring user", "request": { "session": "rootSession", - "uri": "debug/inbox/email/test_user_referring_multi@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/test_user_referring_multi@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' === 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' === 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' === 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' === 'account'"} ] diff --git a/bubble-server/src/test/resources/models/tests/promo/referral_month_free.json b/bubble-server/src/test/resources/models/tests/promo/referral_month_free.json index 4bc94f04..fd418019 100644 --- a/bubble-server/src/test/resources/models/tests/promo/referral_month_free.json +++ b/bubble-server/src/test/resources/models/tests/promo/referral_month_free.json @@ -45,12 +45,12 @@ "comment": "root: check email inbox for welcome message for referring user", "request": { "session": "rootSession", - "uri": "debug/inbox/email/test_user_referring_free@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/test_user_referring_free@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] @@ -119,12 +119,12 @@ "comment": "as root, check email inbox for welcome message", "request": { "session": "rootSession", - "uri": "debug/inbox/email/test_user_referred_free@example.com?type=notice&action=welcome&target=account" + "uri": "debug/inbox/email/test_user_referred_free@example.com?type=request&action=welcome&target=account" }, "response": { "store": "emailInbox", "check": [ - {"condition": "'{{json.[0].ctx.message.messageType}}' == 'notice'"}, + {"condition": "'{{json.[0].ctx.message.messageType}}' == 'request'"}, {"condition": "'{{json.[0].ctx.message.action}}' == 'welcome'"}, {"condition": "'{{json.[0].ctx.message.target}}' == 'account'"} ] -- 2.17.1 From 665d9671d1523a39c31bc8371daea1efb1de2fd1 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 17 Sep 2020 13:58:38 +0200 Subject: [PATCH 5/7] Set confirmation.welcome.account message to be quiet --- .../StandardAccountMessageService.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java b/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java index b2a0ad37..af6c98a9 100644 --- a/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java +++ b/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java @@ -18,6 +18,7 @@ import bubble.model.account.message.handlers.*; import bubble.model.cloud.CloudService; import bubble.server.BubbleConfiguration; import lombok.Getter; +import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.cobbzilla.util.collection.NameAndValue; import org.cobbzilla.util.string.StringUtil; @@ -47,7 +48,29 @@ public class StandardAccountMessageService implements AccountMessageService { @Autowired private CloudServiceDAO cloudDAO; @Autowired private BubbleConfiguration configuration; + /** + * If returns true, then email/sms will NOT be sent out for this AccountMessage object. + */ + private boolean isQuietMessage(@NonNull final AccountMessage message) { + if (message.getMessageType() == AccountMessageType.confirmation + && message.getAction() == AccountAction.welcome + && message.getTarget() == ActionTarget.account) { + // No need for confirmation message here. The end user received `request.welcome.account` message with email + // address verification link. When he clicked the link, then the request was approved. That was the only + // required approval, and so it was also confirmed at that moment. Hence, AccountMessage + // `confirmation.welcome.account` is created. But there no real need to send out email at this point to the + // same user. And so this other confirmation message is `quiet`. + return true; + } + return false; + } + @Override public boolean send(AccountMessage message) { + if (isQuietMessage(message)) { + log.info("send(" + message + "): message marked as quiet"); + return false; + } + final String accountUuid = message.getAccount(); final Account account = accountDAO.findByUuid(accountUuid); AccountPolicy policy = policyDAO.findSingleByAccount(accountUuid); -- 2.17.1 From 210962332abadf006c59c1de7167c274d58db7cc Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 17 Sep 2020 14:45:30 +0200 Subject: [PATCH 6/7] Use exact versions of all submodules when building --- bin/first_time_setup.sh | 6 +----- bin/git_update_bubble.sh | 11 ++++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/bin/first_time_setup.sh b/bin/first_time_setup.sh index d751664e..fb4db0d3 100755 --- a/bin/first_time_setup.sh +++ b/bin/first_time_setup.sh @@ -29,8 +29,7 @@ function die { BASE=$(cd $(dirname $0)/.. && pwd) cd ${BASE} -git submodule init || die "Error in git submodule init" -git submodule update || die "Error in git submodule update" +git submodule update --init --recursive || die "Error in git submodule update" pushd utils/cobbzilla-parent mvn install || die "Error installing cobbzilla-parent" @@ -50,9 +49,6 @@ for repo in ${UTIL_REPOS} ; do done popd -MESSAGES_REPO=bubble-server/src/main/resources/messages -pushd ${MESSAGES_REPO} && git checkout master && popd || die "Error installing ${MESSAGES_REPO}" - if [[ -z "${BUBBLE_SETUP_MODE}" || "${BUBBLE_SETUP_MODE}" == "web" ]] ; then INSTALL_WEB=web mvn -DskipTests=true -Dcheckstyle.skip=true clean package || die "Error building bubble jar" diff --git a/bin/git_update_bubble.sh b/bin/git_update_bubble.sh index 215e129e..b0f7e5c6 100755 --- a/bin/git_update_bubble.sh +++ b/bin/git_update_bubble.sh @@ -32,10 +32,10 @@ cd ${BASE} git fetch || die "Error calling git fetch" git pull origin master || die "Error calling git pull origin master" -git submodule update || die "Error in git submodule update" +git submodule update --init --recursive || die "Error in git submodule update" pushd utils/cobbzilla-parent -git fetch && git checkout master && git pull origin master && mvn install || die "Error updating cobbzilla-parent" +mvn install || die "Error installing cobbzilla-parent" popd UTIL_REPOS=" @@ -49,16 +49,13 @@ abp-parser pushd utils for repo in ${UTIL_REPOS} ; do if [[ ${FAST} -eq 1 ]] ; then - pushd ${repo} && git fetch && git checkout master && git pull origin master && mvn -DskipTests=true -Dcheckstyle.skip=true install && popd || die "Error updating ${repo}" + pushd ${repo} && mvn -DskipTests=true -Dcheckstyle.skip=true install && popd || die "Error installing ${repo}" else - pushd ${repo} && git fetch && git checkout master && git pull origin master && mvn -DskipTests=true -Dcheckstyle.skip=true clean install && popd || die "Error updating ${repo}" + pushd ${repo} && mvn -DskipTests=true -Dcheckstyle.skip=true clean install && popd || die "Error installing ${repo}" fi done popd -MESSAGES_REPO=bubble-server/src/main/resources/messages -pushd ${MESSAGES_REPO} && git fetch && git checkout master && git pull origin master && popd || die "Error updating ${MESSAGES_REPO}" - if [[ ${FAST} -eq 1 ]] ; then mvn -DskipTests=true -Dcheckstyle.skip=true clean package || die "Error building bubble jar" else -- 2.17.1 From a7087df1b883f60eb2cdf04effff63f62d9cf862 Mon Sep 17 00:00:00 2001 From: Kristijan Mitrovic Date: Thu, 17 Sep 2020 15:54:57 +0200 Subject: [PATCH 7/7] Create AccountMessage in DB only if Account is still there --- .../service/account/StandardAccountMessageService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java b/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java index af6c98a9..c509d224 100644 --- a/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java +++ b/bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java @@ -167,13 +167,15 @@ public class StandardAccountMessageService implements AccountMessageService { approval.setRequestContact(policy.findContactByUuid(approval.getRequest().getContact())); getCompletionHandler(approval).confirm(approval, data); - final AccountMessage confirm = messageDAO.create( - new AccountMessage(approval).setMessageType(AccountMessageType.confirmation)); + final AccountMessage confirm = new AccountMessage(approval).setMessageType(AccountMessageType.confirmation); if (approval.hasConfirmationTokensToRemove()) { final RedisService tokens = getConfirmationTokens(); for (String toRemove : approval.getConfirmationTokensToRemove()) tokens.del(toRemove); } - return confirm; + + // Write AccountMessage entity into database only if Account is still available in there + // (i.e. not removed with block_delete deletion policy) + return accountDAO.exists(confirm.getAccount()) ? messageDAO.create(confirm) : confirm; } else if (approvalStatus.ok()) { if (approval.hasConfirmationTokensToRemove()) { -- 2.17.1