mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-15 14:35:54 +00:00
Fix incorrectly using delete instead of uplete in update_banned_when_expired (#5316)
This commit is contained in:
parent
15473e5137
commit
712197f53c
1 changed files with 16 additions and 6 deletions
|
@ -3,6 +3,7 @@ use chrono::{DateTime, TimeZone, Utc};
|
||||||
use clokwerk::{AsyncScheduler, TimeUnits as CTimeUnits};
|
use clokwerk::{AsyncScheduler, TimeUnits as CTimeUnits};
|
||||||
use diesel::{
|
use diesel::{
|
||||||
dsl::{exists, not, IntervalDsl},
|
dsl::{exists, not, IntervalDsl},
|
||||||
|
query_builder::AsQuery,
|
||||||
sql_query,
|
sql_query,
|
||||||
sql_types::{Integer, Timestamptz},
|
sql_types::{Integer, Timestamptz},
|
||||||
BoolExpressionMethods,
|
BoolExpressionMethods,
|
||||||
|
@ -37,7 +38,15 @@ use lemmy_db_schema::{
|
||||||
post::{Post, PostUpdateForm},
|
post::{Post, PostUpdateForm},
|
||||||
},
|
},
|
||||||
traits::Crud,
|
traits::Crud,
|
||||||
utils::{find_action, functions::coalesce, get_conn, now, DbPool, DELETED_REPLACEMENT_TEXT},
|
utils::{
|
||||||
|
find_action,
|
||||||
|
functions::coalesce,
|
||||||
|
get_conn,
|
||||||
|
now,
|
||||||
|
uplete,
|
||||||
|
DbPool,
|
||||||
|
DELETED_REPLACEMENT_TEXT,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use lemmy_routes::nodeinfo::{NodeInfo, NodeInfoWellKnown};
|
use lemmy_routes::nodeinfo::{NodeInfo, NodeInfoWellKnown};
|
||||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||||
|
@ -389,11 +398,12 @@ async fn update_banned_when_expired(pool: &mut DbPool<'_>) -> LemmyResult<()> {
|
||||||
.execute(&mut conn)
|
.execute(&mut conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
diesel::delete(
|
uplete::new(community_actions::table.filter(community_actions::ban_expires.lt(now().nullable())))
|
||||||
community_actions::table.filter(community_actions::ban_expires.lt(now().nullable())),
|
.set_null(community_actions::received_ban)
|
||||||
)
|
.set_null(community_actions::ban_expires)
|
||||||
.execute(&mut conn)
|
.as_query()
|
||||||
.await?;
|
.execute(&mut conn)
|
||||||
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue