Skip to content

Commit

Permalink
add missing delay variable in email
Browse files Browse the repository at this point in the history
  • Loading branch information
kpitn committed Aug 20, 2024
1 parent f409bbb commit ebabae0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Model/Customer/Notifier/MailSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Mail\Template\TransportBuilder;
use Magento\Store\Model\StoreManagerInterface;
use Opengento\Gdpr\Model\EraseEntityManagement;
use Opengento\Gdpr\Model\Notifier\AbstractMailSender;

class MailSender extends AbstractMailSender implements SenderInterface
Expand All @@ -24,6 +25,7 @@ class MailSender extends AbstractMailSender implements SenderInterface
private StoreManagerInterface $storeManager;

public function __construct(
protected EraseEntityManagement $entityManagement,
View $customerViewHelper,
TransportBuilder $transportBuilder,
ScopeConfigInterface $scopeConfig,
Expand All @@ -42,8 +44,11 @@ public function __construct(
*/
public function send(CustomerInterface $customer): void
{
$delay = $this->entityManagement->resolveErasureDelay();

$storeId = $customer->getStoreId() === null ? null : (int)$customer->getStoreId();
$vars = [
'delay' => $delay !== 0 ? $delay / 60 : 0,
'customer' => $customer,
'store' => $this->storeManager->getStore($customer->getStoreId()),
'customer_data' => [
Expand Down
2 changes: 1 addition & 1 deletion Model/EraseEntityManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private function retrieveScheduledAt(): string
);
}

private function resolveErasureDelay(): int
public function resolveErasureDelay(): int
{
return (int)$this->scopeConfig->getValue(self::CONFIG_PATH_ERASURE_DELAY);
}
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/email/erase_pending.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tr class="email-summary">
<td>
<p>{{trans "We have received a request to erase the information associated with your account at %store_name." store_name=$store.getFrontendName()}}</p>
<p>{{trans 'You can cancel the erase within %delay hours by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}</p>
<p>{{trans 'You can cancel the erase within %delay hours by <a href="%account_url">logging into your account</a>.' delay=$delay account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}</p>
</td>
</tr>
<tr class="help-info">
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/email/erase_pending_guest.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tr class="email-summary">
<td>
<p>{{trans "We have received a request to erase the information associated with your account at %store_name." store_name=$store.getFrontendName()}}</p>
<p>{{trans 'You can cancel the erase within %delay hours by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}</p>
<p>{{trans 'You can cancel the erase within %delay hours by <a href="%account_url">logging into your account</a>.' delay=$delay account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}</p>
</td>
</tr>
<tr class="help-info">
Expand Down

0 comments on commit ebabae0

Please sign in to comment.