Issue #3619635: Carry a message type rather than an error boolean

A message the booking stepper shows carried ['text' => string, 'error' => bool], so the only two things it could be were an error and not-an-error. The stylesheet already said the false half was a warning rather than an absence of one: the base rule was amber and read "still reading as a warning rather than as an error". A plain confirmation had no way to be said at all.

What it carries now

Drupal\yoyaku\BookingMessage: a text and a type, the type being one of core's own MessengerInterface::TYPE_STATUS, TYPE_WARNING and TYPE_ERROR. Type, not level, because that is core's noun for it.

  • UnitAssignment::$messages and BookingResult::$messages replace the two $notices arrays, both typed BookingMessage[]. The placement seam sets the type, because it is the layer that knows which is which, and the engine carries it out untouched.
  • OfferClaim::getMessages() is gone, and so are the array_map(createWarning(...)) calls that used to level an assignment's notices one step too late. There is nothing left to convert.
  • SelectionBooker answers with one messages list rather than errors plus notices, so CalendarBookingForm and PlaceBookingForm each lost a loop: addMessage($message->text, $message->type).
  • Both JSON envelopes say messages and carry the type: the API client's order representation and the seat map's answer.

The type that had no producer

The point of the issue was that a plain confirmation could not be said. It has a producer now, and it was already in the code:

sentence type
Your places have moved to the part of the house you asked for. status
Your places are in another row now. warning
...not all next to each other / spread around the venue warning

The first is a confirmation of what the booker asked for, and it was showing amber because everything from the placement was flattened to a warning. AreaChoiceTest is where both arrive in one answer, so that is where the split is asserted.

The seat map had the same bug from the other end: venue-map.js showed every one of these as status, so the same "we could not seat you side by side" sentence was green on the plan and amber on the price list. It reads the type now.

On the client

Drupal.yoyaku.say() is gone. Core has no say(); it has Drupal.Message, so there is Drupal.yoyaku.Message, method for method: new Drupal.yoyaku.Message(region), add(message, {type, id}), clear(). topic became id, the element parameter is messageWrapper, and the one deliberate divergence from core is that there is no defaultWrapper(): a message about one offer said at the top of the page names no offer.

Notice is not a word this module uses any more

The last of the old vocabulary went with it: yoyaku-notice__line--<type> became yoyaku-message--<type> inside a yoyaku-messages region, which is core's own shape (messages messages--error per item). Same for the seat map (ysm-messages, ysm-message--<type>, ysm-message__dismiss), the DOM ids, the settings key notice_seconds to message_seconds, and the docs.

Two user-facing strings moved, so translations/yoyaku.fr.po is updated in the same commit; the French already said message, only the English msgids were behind.

Reinstall note: message_seconds is a config key. config/install never reaches an installed site, so a site that had set the old key falls back to the 5 second default until it is reinstalled or the key is set by hand. Pre-1.0 and reinstall-only, so no update hook.

Checks

Pipeline green job by job, every allow_failure one read rather than trusted, on both lanes. Locally: phpcs exit 0 on CI's ruleset and on Drupal,DrupalPractice, eslint 0 errors under core's .eslintrc.passing.json, cspell clean, phpstan level 3 adds nothing, check-translations.php reports every shipped string translated, and the kernel classes over every touched seam green on MySQL.

Rebased twice, onto #3619790 and then #3619712; the second had real conflicts, where #3619712 gave the test helpers verbs on the same lines this renames. Both sides are kept.

Not touched: the error key on the JSON response envelopes several controllers return beside ok. That is a failed request carrying its reason, not a message with a type.

Edited by Frank Mably

Merge request reports

Loading
Loading