fix: ads balance check

This commit is contained in:
trisua 2025-08-11 22:53:38 -04:00
parent 9a5236bc1b
commit 83971b3d20
3 changed files with 9 additions and 4 deletions

View file

@ -38,7 +38,7 @@
(icon (text "clock"))
(span (str (text "economy:label.recent_transfers")))))
(div
("class" "card lowered flex flex_col gap_4")
("class" "card flex flex_col gap_4")
(div
("class" "w_full")
("style" "overflow: auto")

View file

@ -104,7 +104,12 @@ pub async fn update_is_running_request(
None => return Json(Error::NotAllowed.into()),
};
if user.coins < 50 {
let ad = match data.get_ad_by_id(id).await {
Ok(x) => x,
Err(e) => return Json(e.into()),
};
if !ad.is_running && user.coins < 50 {
return Json(
Error::MiscError(
"You must have a minimum of 50 coins in your balance to run ads".to_string(),

View file

@ -228,12 +228,12 @@ impl DataManager {
let ad = self.get_ad_by_id(ad).await?;
if let Some(ref ua) = user {
if ua.id == ad.owner || ua.id == host {
if ua.id == host {
self.create_user_warning(
UserWarning::new(
ua.id,
self.0.0.system_user,
"Automated warning: do not click on ads on your own site OR click on your own ads! This incident has been reported.".to_string()
"Automated warning: do not click on ads on your own site! This incident has been reported.".to_string()
)
).await?;