Update message displayed regardless of module settings

Created on 6 June 2020, over 4 years ago
Updated 15 September 2023, about 1 year ago

Apologies, maybe this is just me, but I'm still seeing the update messages after a crop has been changed, despite the fact I disabled them in the admin menu.

I can confirm this is entered into the module config correctly:

settings:
  [...]
  notify_apply: false
  notify_update: false

Yet, I'm getting notification the message: The crop My Crop Type were successfully updated for image My File.

I had a quick look at the code. Is it possible somebody forgot to check the settings variable prior to printing the message?

In function updateCrop in file src/ImageWidgetCropManager.php:

      /** @var \Drupal\crop\Entity\Crop $crop */
      foreach ($crops as $crop) {
        if (!$this->cropHasChanged($crop_properties, array_merge($crop->position(), $crop->size()))) {
          return;
        }

        $this->updateCropProperties($crop, $crop_properties);
        $this->messenger()->addMessage($this->t('The crop "@cropType" were successfully updated for image "@filename".', ['@cropType' => $crop_type->label(), '@filename' => $this->fileStorage->load($field_value['file-id'])->getFilename()]));
      }

Is this intentional or am I missing something?

And while we're at it... is it correct that the if statement above on line 121 should return; rather than continue;? It looks to me as if some crops might not get saved in case the previous one has not been changed.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

User interface

Created by

πŸ‡©πŸ‡ͺGermany PhilippVerpoort Berlin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024