Not a bug Manually expiring a user upgrade does not remove the user upgrade active record

Xon

Well-known member
Affected version
2.0.4
Code:
/** @var \XF\Service\User\Downgrade $downgradeService */
$downgradeService = $this->service('XF:User\Downgrade', $activeUpgrade->Upgrade, $activeUpgrade->User);
$downgradeService->setSendAlert(false);
$downgradeService->downgrade();

Since there is no 3rd argument, the UserUpgradeActive record is not removed, just the changes for the upgrade record.
 
Is that actually a proven bug you have experienced, or just summising from the service instantiation?

I haven't tested it yet but it should be getting the active record from this bit of the code:
PHP:
if (!$this->activeUpgrade)
{
    $activeUpgrades = $upgrade->Active;
    $this->activeUpgrade = isset($activeUpgrades[$user->user_id]) ? $activeUpgrades[$user->user_id] : null;
}
That said clearly in this case we'd might as well just pass the active upgrade record in (seeing as that's what we start with) but just curious if that code above isn't working for some reason.
 
Apologies, it does work as expected.

Must have been something wonky with my add-on code when I was inspecting the results.
 
That’s ok. I think I’ll make a change anyway for the reasons I mentioned before. Though now I’ve got a niggling feeling that we did it like that deliberately.

Maybe if it ain’t broke...
 
Top Bottom