mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 17:34:00 +00:00
Add missing docs for community activities (fixes #1250)
I also noticed that community delete was sending the full community json, so I changed that to send the ID instead.
This commit is contained in:
parent
5e2a5c0266
commit
b97879e3f0
2 changed files with 52 additions and 7 deletions
|
@ -559,6 +559,56 @@ Sent to: User
|
|||
|---|---|---|
|
||||
| `object` | yes | Any `Create`, `Update`, `Like`, `Dislike`, `Delete` `Remove` or `Undo` activity as described above |
|
||||
|
||||
### Remove or Delete Community
|
||||
|
||||
```json
|
||||
{
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"id": "http://ds9.lemmy.ml/activities/remove/e4ca7688-af9d-48b7-864f-765e7f9f3591",
|
||||
"type": "Remove",
|
||||
"actor": "http://ds9.lemmy.ml/u/picard",
|
||||
"cc": [
|
||||
"http://ds9.lemmy.ml/c/some_community/followers"
|
||||
],
|
||||
"to": "https://www.w3.org/ns/activitystreams#Public",
|
||||
"object": "http://ds9.lemmy.ml/c/some_community"
|
||||
}
|
||||
```
|
||||
|
||||
| Field Name | Mandatory | Description |
|
||||
|---|---|---|
|
||||
| `type` | yes | Either `Remove` or `Delete` |
|
||||
|
||||
### Restore Removed or Deleted Community
|
||||
|
||||
```json
|
||||
{
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"id": "http://ds9.lemmy.ml/activities/like/0703668c-8b09-4a85-aa7a-f93621936901",
|
||||
"type": "Undo",
|
||||
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
|
||||
"to": "https://www.w3.org/ns/activitystreams#Public",
|
||||
"cc": [
|
||||
"http://ds9.lemmy.ml/c/testcom/followers"
|
||||
],
|
||||
"object": {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"id": "http://ds9.lemmy.ml/activities/remove/1062b5e0-07e8-44fc-868c-854209935bdd",
|
||||
"type": "Remove",
|
||||
"to": "https://www.w3.org/ns/activitystreams#Public",
|
||||
"cc": [
|
||||
"http://ds9.lemmy.ml/c/testcom/followers"
|
||||
],
|
||||
"object": "http://ds9.lemmy.ml/c/testcom",
|
||||
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
| Field Name | Mandatory | Description |
|
||||
|---|---|---|
|
||||
| `object.type` | yes | Either `Remove` or `Delete` |
|
||||
|
||||
### Create or Update Private message
|
||||
|
||||
Creates a new private message between two users.
|
||||
|
|
|
@ -4,7 +4,6 @@ use crate::{
|
|||
check_is_apub_id_valid,
|
||||
fetcher::get_or_fetch_and_upsert_user,
|
||||
ActorType,
|
||||
ToApub,
|
||||
};
|
||||
use activitystreams::{
|
||||
activity::{
|
||||
|
@ -86,9 +85,7 @@ impl ActorType for Community {
|
|||
|
||||
/// If the creator of a community deletes the community, send this to all followers.
|
||||
async fn send_delete(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
|
||||
let group = self.to_apub(context.pool()).await?;
|
||||
|
||||
let mut delete = Delete::new(creator.actor_id.to_owned(), group.into_any_base()?);
|
||||
let mut delete = Delete::new(creator.actor_id.to_owned(), self.actor_id()?);
|
||||
delete
|
||||
.set_context(activitystreams::context())
|
||||
.set_id(generate_activity_id(DeleteType::Delete)?)
|
||||
|
@ -105,9 +102,7 @@ impl ActorType for Community {
|
|||
creator: &User_,
|
||||
context: &LemmyContext,
|
||||
) -> Result<(), LemmyError> {
|
||||
let group = self.to_apub(context.pool()).await?;
|
||||
|
||||
let mut delete = Delete::new(creator.actor_id.to_owned(), group.into_any_base()?);
|
||||
let mut delete = Delete::new(creator.actor_id.to_owned(), self.actor_id()?);
|
||||
delete
|
||||
.set_context(activitystreams::context())
|
||||
.set_id(generate_activity_id(DeleteType::Delete)?)
|
||||
|
|
Loading…
Reference in a new issue