Giter VIP home page Giter VIP logo

Comments (3)

janboddez avatar janboddez commented on July 20, 2024

[I]t doesn't prevent, e.g., Mastodon from GETting the post.

Alternatively, hooking into an early filter and attempting to detect whether a post or comment should be excluded and then removing the default template callback might just work.

Wouldn't scrub these posts from outboxes or "featured" collections, though.

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

Wouldn't scrub these posts from outboxes or "featured" collections, though.

May be possible to filter pre_get_posts or similar, exclude certain categories or similar (think tax_query, meta_query), maybe based on the current $_SERVER['REQUEST_URI'].

from addon-for-activitypub.

janboddez avatar janboddez commented on July 20, 2024

For preventing fetching "disabled" posts, we could simply use:

add_filter( 'template_include', function ( $template ) {
  if ( is_singular() && in_category( 'disable-activitypub' ) ) {
    remove_filter( 'template_include', array( \Activitypub\Activitypub::class, 'render_json_template' ), 99 );
  }

  return $template;
} );

To disable posting these posts:

add_filter( 'activitypub_send_activity_to_followers', function ( $send, $activity, $user_id, $wp_object ) {
  if ( $wp_object instanceof \WP_Post && in_category( 'disable-activitypub', $wp_object ) ) {
    return false;
  }

  return $send;
}, 10, 4 );

from addon-for-activitypub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.