Create subscription relationship only if subscription is still active
This prevents spurious expiration notifications after withdrawals.
This commit is contained in:
parent
79e161c131
commit
78b9fc7878
1 changed files with 3 additions and 1 deletions
|
@ -77,7 +77,9 @@ pub async fn update_subscription(
|
|||
let row = maybe_row.ok_or(DatabaseError::NotFound("subscription"))?;
|
||||
let sender_id: Uuid = row.try_get("sender_id")?;
|
||||
let recipient_id: Uuid = row.try_get("recipient_id")?;
|
||||
if *expires_at > Utc::now() {
|
||||
subscribe_opt(&transaction, &sender_id, &recipient_id).await?;
|
||||
};
|
||||
transaction.commit().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue