Confirmed emails are set to expired

Created on 5 September 2019, over 5 years ago
Updated 13 December 2023, about 1 year ago

Hi,

I've noticed that confirmed and cancelled email confirmations are set to expired when try to getStatus() when they pass the time set up in the UI.

Changing the order of the condition solves this issue:
Before:

 public function getStatus() {
    if ($this->isExpired()) {
      $status = 'expired';
    }
    elseif ($this->isCancelled()) {
      $status = 'cancelled';
    }
    elseif ($this->isConfirmed()) {
      $status = 'confirmed';
    }
    else {
      $status = 'pending';
    }

    return $status;
  }

After:

  public function getStatus() {
    if ($this->isCancelled()) {
      $status = 'cancelled';
    }
    elseif ($this->isConfirmed()) {
      $status = 'confirmed';
    }
    elseif ($this->isExpired()) {
        $status = 'expired';
    }
    else {
      $status = 'pending';
    }

    return $status;
  }
📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom lexsoft00

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • Status changed to Closed: won't fix 3 days ago
  • 🇪🇸Spain manuel.adan 🌌

    Going deeper into this, it makes sense that the expired status also means that there was no response to the confirmation request. But according to the getStatus() method documentation, expired status is returned regardless of any other condition:

      [ ... ]
       * - expired: the confirmation age is over the allowed maximum, regardless
       *   of any other status
       *
       * Note that an expired confirmation could be confirmed as well. Check
       * the confirmed status with the isConfirmed method.
      [ ... ]
    

    Therefore, the patch introduces changes to the API and may break any existing implementation using this method.

    Postponed for the 2.x branch.

Production build 0.71.5 2024