Переглянути джерело

Create AccountMessage in DB only if Account is still there

pull/55/head
Kristijan Mitrovic 4 роки тому
джерело
коміт
a7087df1b8
1 змінених файлів з 5 додано та 3 видалено
  1. +5
    -3
      bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java

+ 5
- 3
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()) {


Завантаження…
Відмінити
Зберегти