forked from alemi/upub
fix: maybe must be unchanged?
This commit is contained in:
parent
e7acc420f1
commit
2d08511e05
2 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
use apb::{target::Addressed, Activity, Base, Object};
|
||||
use sea_orm::{sea_query::Expr, ActiveValue::{NotSet, Set}, ColumnTrait, Condition, DatabaseTransaction, EntityTrait, QueryFilter, QuerySelect, SelectColumns};
|
||||
use sea_orm::{sea_query::Expr, ActiveValue::{NotSet, Set, Unchanged}, ColumnTrait, Condition, DatabaseTransaction, EntityTrait, QueryFilter, QuerySelect, SelectColumns};
|
||||
use crate::{ext::{AnyQuery, LoggableError}, model, traits::{fetch::Pull, Fetcher, Normalizer}};
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
@ -263,7 +263,7 @@ pub async fn update(ctx: &crate::Context, activity: impl apb::Activity, tx: &Dat
|
|||
.await?
|
||||
.ok_or(ProcessorError::Incomplete)?;
|
||||
let mut actor_model = crate::AP::actor_q(object_node.as_actor()?)?;
|
||||
actor_model.internal = Set(internal_uid);
|
||||
actor_model.internal = Unchanged(internal_uid);
|
||||
actor_model.updated = Set(chrono::Utc::now());
|
||||
crate::model::actor::Entity::update(actor_model)
|
||||
.exec(tx)
|
||||
|
@ -274,7 +274,7 @@ pub async fn update(ctx: &crate::Context, activity: impl apb::Activity, tx: &Dat
|
|||
.await?
|
||||
.ok_or(ProcessorError::Incomplete)?;
|
||||
let mut object_model = crate::AP::object_q(&object_node)?;
|
||||
object_model.internal = Set(internal_oid);
|
||||
object_model.internal = Unchanged(internal_oid);
|
||||
object_model.updated = Set(chrono::Utc::now());
|
||||
crate::model::object::Entity::update(object_model)
|
||||
.exec(tx)
|
||||
|
|
|
@ -62,6 +62,9 @@ pub async fn process(ctx: Context, job: &model::job::Model) -> crate::JobResult<
|
|||
));
|
||||
}
|
||||
|
||||
// TODO very important that we limit Update activities!!! otherwise with .process() local users
|
||||
// can change their document completely
|
||||
|
||||
let targets = activity.addressed();
|
||||
ctx.process(activity, &tx).await?;
|
||||
ctx.deliver(targets, &job.activity, &job.actor, &tx).await?;
|
||||
|
|
Loading…
Reference in a new issue