forked from alemi/upub
fix: mastodon doesn't tell who likes are intended
why cant you fill your to fields???????? mastodon is a joke
This commit is contained in:
parent
583ddce914
commit
64d7f25aa2
1 changed files with 13 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
use apb::{target::Addressed, Activity, Base, Object};
|
use apb::{target::Addressed, Activity, Base, Object};
|
||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
use sea_orm::{sea_query::Expr, ActiveModelTrait, ColumnTrait, Condition, EntityTrait, IntoActiveModel, QueryFilter, Set};
|
use sea_orm::{sea_query::Expr, ActiveModelTrait, ColumnTrait, Condition, EntityTrait, IntoActiveModel, QueryFilter, QuerySelect, SelectColumns, Set};
|
||||||
|
|
||||||
use crate::{errors::{LoggableError, UpubError}, model::{self, FieldError}};
|
use crate::{errors::{LoggableError, UpubError}, model::{self, FieldError}};
|
||||||
|
|
||||||
|
@ -98,7 +98,18 @@ impl apb::server::Inbox for Context {
|
||||||
model::activity::Entity::insert(activity_model)
|
model::activity::Entity::insert(activity_model)
|
||||||
.exec(self.db())
|
.exec(self.db())
|
||||||
.await?;
|
.await?;
|
||||||
let expanded_addressing = self.expand_addressing(activity.addressed()).await?;
|
let mut expanded_addressing = self.expand_addressing(activity.addressed()).await?;
|
||||||
|
if expanded_addressing.is_empty() { // WHY MASTODON!!!!!!!
|
||||||
|
expanded_addressing.push(
|
||||||
|
model::object::Entity::find_by_id(&oid)
|
||||||
|
.select_only()
|
||||||
|
.select_column(model::object::Column::AttributedTo)
|
||||||
|
.into_tuple::<String>()
|
||||||
|
.one(self.db())
|
||||||
|
.await?
|
||||||
|
.ok_or_else(UpubError::not_found)?
|
||||||
|
);
|
||||||
|
}
|
||||||
self.address_to(Some(aid), None, &expanded_addressing).await?;
|
self.address_to(Some(aid), None, &expanded_addressing).await?;
|
||||||
model::object::Entity::update_many()
|
model::object::Entity::update_many()
|
||||||
.col_expr(model::object::Column::Likes, Expr::col(model::object::Column::Likes).add(1))
|
.col_expr(model::object::Column::Likes, Expr::col(model::object::Column::Likes).add(1))
|
||||||
|
|
Loading…
Reference in a new issue