Status icons on webhook events overview are broken on non-english sites

Created on 18 November 2024, 3 months ago

Hi,
this code

$statuses = WebhookEvent::getStatuses();
Html::getClass('webhook-event-' . strtolower($statuses[$webhook_event->status])),

will not work correctly on non-english sites because getStatuses() returns the translated value of the status.
Personally I created a separate function:

public static function getStatusesRaw(): array {
    return [
      self::STATUS_UNPROCESSED => 'unprocessed',
      self::STATUS_SUCCEEDED => 'succeeded',
      self::STATUS_FAILED => 'failed',
      self::STATUS_SKIPPED => 'skipped',
    ];
  }

and replaced the code with

Html::getClass('webhook-event-' . $statuses_raw[$webhook_event->status]),
πŸ› Bug report
Status

Active

Version

1.2

Component

Code

Created by

πŸ‡«πŸ‡·France nicolas bouteille

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

Merge Requests

Comments & Activities

  • Issue created by @nicolas bouteille
  • πŸ‡«πŸ‡·France nicolas bouteille

    BTW, I noticed you created both a view (available in views.view.commerce_stripe_webhook_event.yml) and a custom route with the overview callback. I figured you created the view first but then switched to the custom route as a replacement but never deleted the optional config file. Is that right?

  • πŸ‡ΊπŸ‡ΈUnited States TomTech

    @ nicolas-bouteille Good catch on the status. Sorry I missed that. :-/

    IRT the view/route, the view is the intended UX for the listing page, as it provides all the magic of views, e.g. filtering, adding/reordering fields, etc...

    The route callback is a fallback. If the view is deleted or hijacked to another path, it provides a minimalist listing.

  • πŸ‡«πŸ‡·France nicolas bouteille

    Thanks for the quick reply!
    Ok then if I am not mistaken, the view config is not imported.
    I noticed commerce_stripe_webhook_event_update_9101 is responsible to import advancedqueue.advancedqueue_queue.commerce_stripe_webhook_event.yml
    but their does not seem to be a code importing views.view.commerce_stripe_webhook_event.yml

  • πŸ‡ΊπŸ‡ΈUnited States TomTech

    The (optional) configs are imported when the module is first enabled.

    The queue functionality/config was added later, so the db update was created as a convenience to install it for anyone who already had the module installed.

    Anyone doing a clean install of the module would get both installed from the config directory when the module is enabled(presuming requirements are met).

    If the view is not installed, then most likely:
    1. the views module installed when the submodule was first enabled
    2. the view was manually deleted
    3. config sync is being used, and the views config was not exported and saved. Then, a config import was done, deleting the view

    You can easily re-create the view by going to config import in the UX, selecting import single item, selecting view, and then pasting in the contents of this config file.

  • πŸ‡«πŸ‡·France nicolas bouteille

    ok thanks!

    • tomtech β†’ committed afe64bb4 on 8.x-1.x
      Issue #3488118: Status icons on webhook events overview are broken on...
  • πŸ‡ΊπŸ‡ΈUnited States TomTech
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024