Add postingRestrictedToMods to channels AP objects

See https://github.com/LemmyNet/lemmy/issues/3837
pull/6266/head
Chocobozzz 2024-02-27 15:46:38 +01:00
parent 2e760485c1
commit a4b497c2a9
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,9 @@ export interface ActivityPubActor {
publicKeyPem: string
}
// Lemmy attribute for groups
postingRestrictedToMods?: boolean
image?: ActivityIconObject | ActivityIconObject[]
icon?: ActivityIconObject | ActivityIconObject[]

View File

@ -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'
}),

View File

@ -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...