Skip to main content

check_visibility

Function check_visibility 

Source
async fn check_visibility(
    channel: &GuildChannel,
    source_channel: &GuildChannel,
    ctx: &Context,
) -> Result<(), PreviewError>
Expand description

Validates that everyone who can view source_channel could also view channel.

The expanded content is posted as a single message that all members of source_channel can read, so the linked channel must be at least as visible as the source channel to avoid leaking restricted content.

Both channels must be in the same guild, which Preview::get guarantees by refusing cross-guild links: the role data this compares them against is guild-local and would be meaningless otherwise.

Comparison is by role set, which cannot express per-member grants, so those are handled by separate conservative guards: has_member_view_deny on the target and member_granted_source_is_safe on the source.