Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings in az_mail/config/quickstart no longer apply. #3588

Closed
trackleft opened this issue Aug 1, 2024 · 0 comments · Fixed by #3589
Closed

Settings in az_mail/config/quickstart no longer apply. #3588

trackleft opened this issue Aug 1, 2024 · 0 comments · Fixed by #3589
Assignees
Labels
bug Something isn't working

Comments

@trackleft
Copy link
Member

Problem/Motivation

The settings in the az_mail module are not being applied when the module is enabled.

Describe the bug

[notice] Disallowing override of customized configuration smtp.settings.

In modules/custom/az_core/src/Plugin/ConfigProvider/QuickstartConfigProvider.php

The canOverride method incorrectly marks configuration that does not have a snapshot yet as FALSE.

https://github.com/az-digital/az_quickstart/blob/main/modules/custom/az_core/src/Plugin/ConfigProvider/QuickstartConfigProvider.php#L274-L288

To Reproduce

  1. Enable az_mail module
  2. Go to /admin/config/system/smtp
  3. See settings are not applied.

Proposed resolution

Return TRUE in canOverride in https://github.com/az-digital/az_quickstart/blob/main/modules/custom/az_core/src/Plugin/ConfigProvider/QuickstartConfigProvider.php

Something like.

    // Guard against missing items.
    $snap = (!empty($snap)) ? $snap : [];
    $active = (!empty($active)) ? $active : [];

    // Not relevant for user roles. Permissions created dynamically.
    if (strpos($name, 'user.role.') !== 0) {
      // Prune cache_metadata if present, to not consider it for diffs.
      $active = $this->trimNestedKey($active, 'cache_metadata');
      $snap = $this->trimNestedKey($snap, 'cache_metadata');
      // If $snap is empty, then we can't compare it to $active.
      // In this case, we can assume that the configuration is not customized
      // because it is not present in the snapshot.
      // This means that the module (config provider) is not yet installed.
      if (empty($snap)) {
        return TRUE;
      }
      // Diff active config and snapshot of module to check for customization.
      $diff = $differ->diff($active, $snap);
      // Overrides only allowed if no changes in diff.
      if (!$this->diffIsEmpty($diff) && !empty($active)) {
        return FALSE;
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants