Skip to content

Commit

Permalink
Implement separate mod activities for feature, lock post
Browse files Browse the repository at this point in the history
Also includes collection for featured posts. Later we also need
to do the same for Comment.distinguished
  • Loading branch information
Nutomic committed Feb 8, 2023
1 parent 7c1a37d commit 155d5c8
Show file tree
Hide file tree
Showing 54 changed files with 1,219 additions and 702 deletions.
4 changes: 4 additions & 0 deletions crates/api_common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ pub fn generate_outbox_url(actor_id: &DbUrl) -> Result<DbUrl, ParseError> {
Ok(Url::parse(&format!("{actor_id}/outbox"))?.into())
}

pub fn generate_featured_url(actor_id: &DbUrl) -> Result<DbUrl, ParseError> {
Ok(Url::parse(&format!("{actor_id}/featured"))?.into())
}

pub fn generate_moderators_url(community_id: &DbUrl) -> Result<DbUrl, LemmyError> {
Ok(Url::parse(&format!("{community_id}/moderators"))?.into())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"cc": [
"https://ds9.lemmy.ml/c/main"
],
"id": "https://ds9.lemmy.ml/activities/add/47d911f5-52c5-4659-b2fd-0e58c451a427",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Add",
"actor": "https://ds9.lemmy.ml/u/lemmy_alpha",
"object": "https://ds9.lemmy.ml/post/2",
"target": "https://ds9.lemmy.ml/c/main/featured",
"audience": "https://ds9.lemmy.ml/c/main"
}
13 changes: 13 additions & 0 deletions crates/apub/assets/lemmy/activities/community/lock_page.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "http://lemmy-alpha:8541/activities/lock/cb48761d-9e8c-42ce-aacb-b4bbe6408db2",
"actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"object": "http://lemmy-alpha:8541/post/2",
"cc": [
"http://lemmy-alpha:8541/c/main"
],
"type": "Lock",
"audience": "http://lemmy-alpha:8541/c/main"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"cc": [
"https://ds9.lemmy.ml/c/main"
],
"id": "https://ds9.lemmy.ml/activities/add/47d911f5-52c5-4659-b2fd-0e58c451a427",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Remove",
"actor": "https://ds9.lemmy.ml/u/lemmy_alpha",
"object": "https://ds9.lemmy.ml/post/2",
"target": "https://ds9.lemmy.ml/c/main/featured",
"audience": "https://ds9.lemmy.ml/c/main"
}
25 changes: 25 additions & 0 deletions crates/apub/assets/lemmy/activities/community/undo_lock_page.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"id": "http://lemmy-alpha:8541/activities/undo/d6066719-d277-4964-9190-4d6faffac286",
"actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"object": {
"actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"object": "http://lemmy-alpha:8541/post/2",
"cc": [
"http://lemmy-alpha:8541/c/main"
],
"type": "Lock",
"id": "http://lemmy-alpha:8541/activities/lock/08b6fd3e-9ef3-4358-a987-8bb641f3e2c3",
"audience": "http://lemmy-alpha:8541/c/main"
},
"cc": [
"http://lemmy-alpha:8541/c/main"
],
"type": "Undo",
"audience": "http://lemmy-alpha:8541/c/main"
}
51 changes: 51 additions & 0 deletions crates/apub/assets/lemmy/collections/group_featured_posts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"type": "OrderedCollection",
"id": "https://ds9.lemmy.ml/c/main/featured",
"totalItems": 2,
"orderedItems": [
{
"type": "Page",
"id": "https://ds9.lemmy.ml/post/2",
"attributedTo": "https://ds9.lemmy.ml/u/lemmy_alpha",
"to": [
"https://ds9.lemmy.ml/c/main",
"https://www.w3.org/ns/activitystreams#Public"
],
"name": "test 2",
"cc": [],
"mediaType": "text/html",
"attachment": [],
"commentsEnabled": true,
"sensitive": false,
"stickied": true,
"published": "2023-02-06T06:42:41.939437+00:00",
"language": {
"identifier": "de",
"name": "Deutsch"
},
"audience": "https://ds9.lemmy.ml/c/main"
},
{
"type": "Page",
"id": "https://ds9.lemmy.ml/post/1",
"attributedTo": "https://ds9.lemmy.ml/u/lemmy_alpha",
"to": [
"https://ds9.lemmy.ml/c/main",
"https://www.w3.org/ns/activitystreams#Public"
],
"name": "test 1",
"cc": [],
"mediaType": "text/html",
"attachment": [],
"commentsEnabled": true,
"sensitive": false,
"stickied": true,
"published": "2023-02-06T06:42:37.119567+00:00",
"language": {
"identifier": "de",
"name": "Deutsch"
},
"audience": "https://ds9.lemmy.ml/c/main"
}
]
}
1 change: 1 addition & 0 deletions crates/apub/assets/lemmy/objects/group.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"followers": "https://enterprise.lemmy.ml/c/tenforward/followers",
"moderators": "https://enterprise.lemmy.ml/c/tenforward/moderators",
"attributedTo": "https://enterprise.lemmy.ml/c/tenforward/moderators",
"featured": "https://enterprise.lemmy.ml/c/tenforward//featured",
"postingRestrictedToMods": false,
"endpoints": {
"sharedInbox": "https://enterprise.lemmy.ml/inbox"
Expand Down
182 changes: 0 additions & 182 deletions crates/apub/src/activities/community/add_mod.rs

This file was deleted.

Loading

0 comments on commit 155d5c8

Please sign in to comment.