mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 16:34:01 +00:00
Mark user as updated after fetching
This commit is contained in:
parent
6cf4e39406
commit
89f9ecb634
2 changed files with 12 additions and 2 deletions
|
@ -258,8 +258,12 @@ pub(crate) async fn get_or_fetch_and_upsert_user(
|
||||||
recursion_counter,
|
recursion_counter,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
// TODO: do we need to set this? would need a separate db call
|
|
||||||
//uf.last_refreshed_at = Some(naive_now());
|
let user_id = user.id;
|
||||||
|
blocking(context.pool(), move |conn| {
|
||||||
|
User_::mark_as_updated(conn, user_id)
|
||||||
|
})
|
||||||
|
.await??;
|
||||||
|
|
||||||
Ok(user)
|
Ok(user)
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,12 @@ impl User_ {
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mark_as_updated(conn: &PgConnection, user_id: i32) -> Result<User_, Error> {
|
||||||
|
diesel::update(user_.find(user_id))
|
||||||
|
.set((updated.eq(naive_now()),))
|
||||||
|
.get_result::<Self>(conn)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn delete_account(conn: &PgConnection, user_id: i32) -> Result<User_, Error> {
|
pub fn delete_account(conn: &PgConnection, user_id: i32) -> Result<User_, Error> {
|
||||||
diesel::update(user_.find(user_id))
|
diesel::update(user_.find(user_id))
|
||||||
.set((
|
.set((
|
||||||
|
|
Loading…
Reference in a new issue