Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter filter:activity-pub.activity.context.build.result: missing object type as parameter #5873

Open
JohnXLivingston opened this issue Jul 5, 2023 · 0 comments
Labels
Component: Federation 🎡 Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Feature Request ✨

Comments

@JohnXLivingston
Copy link
Contributor

Describe the problem to be solved

When using filter:activity-pub.video.json-ld.build.result to add some specific data in the ActivityPub video object, the documentation recommands using filter:activity-pub.activity.context.build.result to update the JSON-LD context.

filter:activity-pub.video.json-ld.build.result is specific to Video objects, but filter:activity-pub.activity.context.build.result is called for all object types (Video, Comment, Playlist, ...).

There is no easy way to know which object type we are manipulating, so we can't choose to add some specific data only for Video object.

Describe the solution you would like

The hook function should receive an additional type parameter:

async function getContextData (type: ContextType) {
const contextData = await Hooks.wrapObject(
contextStore[type],
'filter:activity-pub.activity.context.build.result'
)
return { '@context': contextData }
}

Should become something like:

async function getContextData (type: ContextType) {
  const contextData = await Hooks.wrapObject(
    contextStore[type],
    'filter:activity-pub.activity.context.build.result',
    { type }
  )

  return { '@context': contextData }
}
@Chocobozzz Chocobozzz added Type: Feature Request ✨ Component: Federation 🎡 Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development labels Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Federation 🎡 Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Feature Request ✨
2 participants