Skip to content

Commit

Permalink
LOC-6167 - Strapi: Hide deprecate source feature (#26)
Browse files Browse the repository at this point in the history
* fix: hide non-fully working deprecate source feature

* style: code cleanup

---------

Co-authored-by: david-vaclavek <vaclavek.dvd@gmail.com>
  • Loading branch information
david-vaclavek and david-vaclavek authored Feb 7, 2023
1 parent 124f2b9 commit 5f7dfe7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,16 @@ function GlobalSettings() {
<Option value="updated">{t("plugin_settings.editing_data_entry")}</Option>
</Select>
{/* Deprecate source keys on deletion */}
<br /><br />
<ToggleInput
label={t("plugin_settings.deprecate_source_keys_on_delete")}
hint={t("plugin_settings.deprecate_source_keys_on_delete_info")}
offLabel={t("plugin_settings.off")}
onLabel={t("plugin_settings.on")}
checked={typeof formModel?.upload?.allowDeprecate === "boolean" ? formModel.upload.allowDeprecate : false}
onChange={e => patchFormModel("upload.allowDeprecate", e.target.checked)} />
<div style={{ display: "none" }}>
<br /><br />
<ToggleInput
label={t("plugin_settings.deprecate_source_keys_on_delete")}
hint={t("plugin_settings.deprecate_source_keys_on_delete_info")}
offLabel={t("plugin_settings.off")}
onLabel={t("plugin_settings.on")}
checked={typeof formModel?.upload?.allowDeprecate === "boolean" ? formModel.upload.allowDeprecate : false}
onChange={e => patchFormModel("upload.allowDeprecate", e.target.checked)} />
</div>
<br /><br />
<Divider />
{/* Download Settings */}
Expand Down
19 changes: 0 additions & 19 deletions server/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const deepPopulateHook = require('./lifecycles/deep-populate-hook');
const uploadEventEntryToLocalazyHook = require('./lifecycles/upload-event-entry-to-localazy-hook');
const deprecateEventEntryInLocalazyHook = require('./lifecycles/deprecate-event-entry-in-localazy-hook');
const RequestInitiatorHelper = require('./utils/request-initiator-helper');

module.exports = ({ strapi }) => {
Expand Down Expand Up @@ -35,24 +34,6 @@ module.exports = ({ strapi }) => {
break;
}
}
case 'beforeDeleteMany':
case 'beforeDelete': {
try {
if (requestInitiatorHelper.isInitiatedByLocalazyWebhook() || requestInitiatorHelper.isInitiatedByLocalazyPluginUI()) {
break;
}

// have to await here
const result = await deprecateEventEntryInLocalazyHook(event);
if (typeof result !== 'undefined') {
strapi.log.info(`${action} hook result: ${JSON.stringify(result)}`);
}
} catch (e) {
strapi.log.error(e);
} finally {
break;
}
}
default:
break;
}
Expand Down
7 changes: 4 additions & 3 deletions server/controllers/localazy-transfer-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ module.exports = {
);
await LocalazyUploadService.upload(
importFile,
{
deprecate: "file"
});
// {
// deprecate: "file"
// }
);

ctx.body = {
success,
Expand Down

0 comments on commit 5f7dfe7

Please sign in to comment.