fix: stripe notification spam
This commit is contained in:
parent
e0e38b2b32
commit
8dfd307919
1 changed files with 10 additions and 1 deletions
|
@ -274,6 +274,15 @@ pub async fn stripe_webhook(
|
||||||
Err(e) => return Json(e.into()),
|
Err(e) => return Json(e.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !user.permissions.check(FinePermission::SUPPORTER) {
|
||||||
|
// the user isn't currently a supporter, there's no reason to send this notification
|
||||||
|
return Json(ApiReturn {
|
||||||
|
ok: true,
|
||||||
|
message: "Acceptable".to_string(),
|
||||||
|
payload: (),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
"unsubscribe (pay fail) {} (stripe: {})",
|
"unsubscribe (pay fail) {} (stripe: {})",
|
||||||
user.id,
|
user.id,
|
||||||
|
@ -303,7 +312,7 @@ pub async fn stripe_webhook(
|
||||||
if let Err(e) = data
|
if let Err(e) = data
|
||||||
.create_notification(Notification::new(
|
.create_notification(Notification::new(
|
||||||
"It seems your recent payment has failed :(".to_string(),
|
"It seems your recent payment has failed :(".to_string(),
|
||||||
"No worries! Your subscription is still active and will be retried. Your supporter status will resume when you have a successful payment.\n\nIf you've cancelled your subscription, you can safely disregard this."
|
"No worries! Your subscription is still active and will be retried. Your supporter status will resume when you have a successful payment."
|
||||||
.to_string(),
|
.to_string(),
|
||||||
user.id,
|
user.id,
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue