Skip to content

Commit

Permalink
Merge pull request #38 from AcclaroInc/hotfix/update_on_delete_event
Browse files Browse the repository at this point in the history
Resolve #134; Filter out console requests for _onDeleteElement() event
  • Loading branch information
sidedwards authored Feb 13, 2020
2 parents 86a98e8 + 8d0077e commit 3117879
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .craftplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"pluginName": "Translations for Craft",
"pluginDescription": "Easily launch and manage multilingual Craft websites without having to copy/paste content or manually track updates.",
"pluginVersion": "1.4.2",
"pluginVersion": "1.4.3",
"pluginAuthorName": "Acclaro",
"pluginVendorName": "Acclaro",
"pluginAuthorUrl": "http://www.acclaro.com/",
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.4.3 - 2020-02-13

### Updated
- Filter out console requests for _onDeleteElement() event

## 1.4.2 - 2020-02-04

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions src/Translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ private function _onApplyDraft(Event $event)

private function _onDeleteElement(Event $event)
{

if (!empty($event->element->draftId)) {
$response = Translations::$plugin->draftRepository->isTranslationDraft($event->element->draftId);
if ($response) {
Expand Down Expand Up @@ -524,7 +523,8 @@ private function _onDeleteElement(Event $event)
}
}

if (Craft::$app->getRequest()->getParam('hardDelete')) {
$request = Craft::$app->getRequest();
if (!$request->getIsConsoleRequest() && $request->getParam('hardDelete')) {
$event->hardDelete = true;
}
}
Expand Down

0 comments on commit 3117879

Please sign in to comment.