Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
check for enable promotional messages before sending it
Browse files Browse the repository at this point in the history
  • Loading branch information
blopa committed Dec 24, 2017
1 parent 7b4ef06 commit 0d97f2d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public function execute()
$messageContent = $promotionalMessage->getContent();
foreach ($uniqueMessageCollection as $message)
{
$chatbotUser = $this->_helper->getChatbotuserBySenderId($message->getSenderId());
if ($chatbotUser->getEnablePromotionalMessages() == $this->_define::DISABLED)
continue;

$content = array(
'content_type' => $this->_define::CONTENT_TEXT,
'content' => $messageContent,
Expand Down
2 changes: 1 addition & 1 deletion Magento2/app/code/Werules/Chatbot/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ private function getChatbotAPIBySenderId($senderId)
return $chatbotAPI;
}

private function getChatbotuserBySenderId($senderId)
public function getChatbotuserBySenderId($senderId)
{
$chatbotAPI = $this->getChatbotAPIModelBySenderId($senderId);
$chatbotUser = $this->_chatbotUserFactory->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</p>
</div>
<?php endif; ?>
<div class="field choice" style="display: none;">
<div class="field choice"> <!-- style="display: none;"-->
<input type="checkbox" name="enable_promotion" id="enable_promotion" value="1" title="<?php echo __("Receive Promotional Messages?") ?>" class="checkbox" <?php if (!$startedChatbot) echo 'disabled'; else if ($enablePromotion) echo 'checked'; ?>>
<label for="enable_promotion" class="label">
<span><?php echo __("Receive Promotional Messages?") ?></span>
Expand Down

0 comments on commit 0d97f2d

Please sign in to comment.