Commit 9e2c4b6c authored by Ide Braakman's avatar Ide Braakman Committed by Sascha Grossenbacher
Browse files

Issue #3157753 by pminf, idebr: Flag sets message although text is empty

parent 155c9c81
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
   */
  Drupal.AjaxCommands.prototype.actionLinkFlash = (ajax, response, status) => {
    if (status === 'success') {
      if (response.message.length) {
        // Prepare a message element.
        const para = document.createElement('P');
        para.innerText = response.message;
@@ -42,6 +43,7 @@
        // Add message element to the DOM.
        document.querySelector(response.selector).appendChild(para);
      }
    }
    else {
      // If the XHR failed, assume the replace command that would normally make
      // the styling disapear has also failed and remove the temporary styling.
+9 −7
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr

  Drupal.AjaxCommands.prototype.actionLinkFlash = function (ajax, response, status) {
    if (status === 'success') {
      if (response.message.length) {
        var para = document.createElement('P');
        para.innerText = response.message;

@@ -30,6 +31,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
        }, false);

        document.querySelector(response.selector).appendChild(para);
      }
    } else {
      var links = [].concat(_toConsumableArray(document.querySelectAll('.flag-waiting')));
      links.forEach(function (link) {
+3 −2
Original line number Diff line number Diff line
@@ -135,8 +135,9 @@ class ActionLinkNoJsController implements ContainerInjectionInterface {
   *   The response object.
   */
  private function generateResponse(EntityInterface $entity, $message) {
    if (!empty($message)) {
      $this->messenger->addMessage($message);

    }
    if ($entity->hasLinkTemplate('canonical')) {
      // Redirect back to the entity. A passed in destination query parameter
      // will automatically override this.