bp_docs_access_protection_for_activity_feed() filters all activity queries to ensure that no off-limits Docs-related content gets into the activity feed. But the query introduces some database/cache overhead, and doesn't need to be performed if there's no chance that the activity query will include any Docs-related activity. We can generally tell this by looking at some combination of the activity query params and the SQL itself. Basically:
if 'bpdocs*' is in the SQL/params, we should filter
if it's "all" scope - no type/component - then we should filter
bp_docs_access_protection_for_activity_feed()
filters all activity queries to ensure that no off-limits Docs-related content gets into the activity feed. But the query introduces some database/cache overhead, and doesn't need to be performed if there's no chance that the activity query will include any Docs-related activity. We can generally tell this by looking at some combination of the activity query params and the SQL itself. Basically: