mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-25 15:31:09 +00:00
Use Patch
type for federation
This commit is contained in:
parent
5c969078a8
commit
98c6726b84
1 changed files with 6 additions and 4 deletions
|
@ -9,16 +9,18 @@ use activitypub_federation::traits::Object;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
/// Same type used by Forgefed
|
||||||
|
/// https://codeberg.org/ForgeFed/ForgeFed/issues/88
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub enum EditType {
|
pub enum PatchType {
|
||||||
Edit,
|
Patch,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ApubEdit {
|
pub struct ApubEdit {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
kind: EditType,
|
kind: PatchType,
|
||||||
pub id: ObjectId<DbEdit>,
|
pub id: ObjectId<DbEdit>,
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub version: EditVersion,
|
pub version: EditVersion,
|
||||||
|
@ -42,7 +44,7 @@ impl Object for DbEdit {
|
||||||
async fn into_json(self, data: &Data<Self::DataType>) -> Result<Self::Kind, Self::Error> {
|
async fn into_json(self, data: &Data<Self::DataType>) -> Result<Self::Kind, Self::Error> {
|
||||||
let article = DbArticle::read(self.article_id, &data.db_connection)?;
|
let article = DbArticle::read(self.article_id, &data.db_connection)?;
|
||||||
Ok(ApubEdit {
|
Ok(ApubEdit {
|
||||||
kind: EditType::Edit,
|
kind: PatchType::Patch,
|
||||||
id: self.ap_id,
|
id: self.ap_id,
|
||||||
content: self.diff,
|
content: self.diff,
|
||||||
version: self.hash,
|
version: self.hash,
|
||||||
|
|
Loading…
Reference in a new issue