소스 검색

Set confirmation.welcome.account message to be quiet

pull/55/head
Kristijan Mitrovic 4 년 전
부모
커밋
665d9671d1
1개의 변경된 파일23개의 추가작업 그리고 0개의 파일을 삭제
  1. +23
    -0
      bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java

+ 23
- 0
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);


불러오는 중...
취소
저장