class NotificationManager {

    @Transactional(propagation = Propagation.REQUIRED)
    public void notifyIssue(Issue issue, AbstractSecuredEntity entity, String htmlText) {
        NotificationSettings newIssueSettings = notificationSettingsManager.load(NotificationType.NEW_ISSUE);
        if (newIssueSettings == null || !newIssueSettings.isEnabled()) {
            LOGGER.info(messageHelper.getMessage(MessageConstants.INFO_NOTIFICATION_TEMPLATE_NOT_CONFIGURED,
                            "new issue"));
            return;
        }

        NotificationMessage message = new NotificationMessage();
        message.setTemplate(new NotificationTemplate(newIssueSettings.getTemplateId()));
        message.setCopyUserIds(getMentionedUsers(issue.getText()));

        Issue copyWithHtml = issue.toBuilder().text(htmlText).build();
        message.setTemplateParameters(jsonMapper.convertValue(copyWithHtml,
                                                              new TypeReference<Map<String, Object>>() {}));

        if (newIssueSettings.isKeepInformedOwner()) {
            PipelineUser owner = userManager.loadUserByName(entity.getOwner());
            message.setToUserId(owner.getId());
        }

        monitoringNotificationDao.createMonitoringNotification(message);
    }

}