fix: ads balance check
This commit is contained in:
parent
9a5236bc1b
commit
83971b3d20
3 changed files with 9 additions and 4 deletions
|
@ -38,7 +38,7 @@
|
||||||
(icon (text "clock"))
|
(icon (text "clock"))
|
||||||
(span (str (text "economy:label.recent_transfers")))))
|
(span (str (text "economy:label.recent_transfers")))))
|
||||||
(div
|
(div
|
||||||
("class" "card lowered flex flex_col gap_4")
|
("class" "card flex flex_col gap_4")
|
||||||
(div
|
(div
|
||||||
("class" "w_full")
|
("class" "w_full")
|
||||||
("style" "overflow: auto")
|
("style" "overflow: auto")
|
||||||
|
|
|
@ -104,7 +104,12 @@ pub async fn update_is_running_request(
|
||||||
None => return Json(Error::NotAllowed.into()),
|
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(
|
return Json(
|
||||||
Error::MiscError(
|
Error::MiscError(
|
||||||
"You must have a minimum of 50 coins in your balance to run ads".to_string(),
|
"You must have a minimum of 50 coins in your balance to run ads".to_string(),
|
||||||
|
|
|
@ -228,12 +228,12 @@ impl DataManager {
|
||||||
let ad = self.get_ad_by_id(ad).await?;
|
let ad = self.get_ad_by_id(ad).await?;
|
||||||
|
|
||||||
if let Some(ref ua) = user {
|
if let Some(ref ua) = user {
|
||||||
if ua.id == ad.owner || ua.id == host {
|
if ua.id == host {
|
||||||
self.create_user_warning(
|
self.create_user_warning(
|
||||||
UserWarning::new(
|
UserWarning::new(
|
||||||
ua.id,
|
ua.id,
|
||||||
self.0.0.system_user,
|
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?;
|
).await?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue