Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add postingRestrictedToMods to channels AP objects

Chocobozzza4b497c2a959
diff --git a/packages/models/src/activitypub/activitypub-actor.ts b/packages/models/src/activitypub/activitypub-actor.ts
index 6340de2878..d3d4aefded 100644
--- a/packages/models/src/activitypub/activitypub-actor.ts
+++ b/packages/models/src/activitypub/activitypub-actor.ts
@@ -27,6 +27,9 @@ export interface ActivityPubActor {
publicKeyPem: string
}
+ // Lemmy attribute for groups
+ postingRestrictedToMods?: boolean
+
image?: ActivityIconObject | ActivityIconObject[]
icon?: ActivityIconObject | ActivityIconObject[]
diff --git a/server/core/helpers/activity-pub-utils.ts b/server/core/helpers/activity-pub-utils.ts
index 7ea701d340..fdbd36d4a0 100644
--- a/server/core/helpers/activity-pub-utils.ts
+++ b/server/core/helpers/activity-pub-utils.ts
@@ -192,6 +192,9 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: string
'@id': 'pt:support'
},
+ lemmy: 'https://join-lemmy.org/ns#',
+ postingRestrictedToMods: 'lemmy:postingRestrictedToMods',
+
// TODO: remove in a few versions, introduced in 4.2
icons: 'as:icon'
}),
diff --git a/server/core/models/video/video-channel.ts b/server/core/models/video/video-channel.ts
index 115e80b681..3b8795d07d 100644
--- a/server/core/models/video/video-channel.ts
+++ b/server/core/models/video/video-channel.ts
@@ -825,16 +825,19 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
async toActivityPubObject (this: MChannelAP): Promise<ActivityPubActor> {
const obj = await this.Actor.toActivityPubObject(this.name)
- return Object.assign(obj, {
+ return {
+ ...obj,
+
summary: this.description,
support: this.support,
+ postingRestrictedToMods: true,
attributedTo: [
{
type: 'Person' as 'Person',
id: this.Account.Actor.url
}
]
- })
+ }
}
// Avoid error when running this method on MAccount... | MChannel...