Limit visibility of some traits and methods

This commit is contained in:
Felix Ableitner 2020-12-01 12:19:24 +01:00
parent 9435994405
commit 2bdb15b06d
3 changed files with 11 additions and 8 deletions

View File

@ -33,7 +33,7 @@ use url::Url;
/// * `activity` the apub activity to be sent
/// * `creator` the local actor which created the activity
/// * `inbox` the inbox url where the activity should be delivered to
pub async fn send_activity_single_dest<T, Kind>(
pub(crate) async fn send_activity_single_dest<T, Kind>(
activity: T,
creator: &dyn ActorType,
inbox: Url,
@ -71,7 +71,7 @@ where
/// * `community` the sending community
/// * `sender_shared_inbox` in case of an announce, this should be the shared inbox of the inner
/// activities creator, as receiving a known activity will cause an error
pub async fn send_to_community_followers<T, Kind>(
pub(crate) async fn send_to_community_followers<T, Kind>(
activity: T,
community: &Community,
context: &LemmyContext,
@ -116,7 +116,7 @@ where
/// * `creator` the creator of the activity
/// * `community` the destination community
///
pub async fn send_to_community<T, Kind>(
pub(crate) async fn send_to_community<T, Kind>(
activity: T,
creator: &User_,
community: &Community,
@ -160,7 +160,7 @@ where
/// * `creator` user who created the comment
/// * `mentions` list of inboxes of users which are mentioned in the comment
/// * `activity` either a `Create/Note` or `Update/Note`
pub async fn send_comment_mentions<T, Kind>(
pub(crate) async fn send_comment_mentions<T, Kind>(
creator: &User_,
mentions: Vec<Url>,
activity: T,

View File

@ -65,7 +65,10 @@ pub async fn sign_and_send(
}
/// Verifies the HTTP signature on an incoming inbox request.
pub fn verify_signature(request: &HttpRequest, actor: &dyn ActorType) -> Result<(), LemmyError> {
pub(crate) fn verify_signature(
request: &HttpRequest,
actor: &dyn ActorType,
) -> Result<(), LemmyError> {
let public_key = actor.public_key().context(location_info!())?;
let verified = CONFIG2
.begin_verify(

View File

@ -111,14 +111,14 @@ fn check_is_apub_id_valid(apub_id: &Url) -> Result<(), LemmyError> {
/// Trait for converting an object or actor into the respective ActivityPub type.
#[async_trait::async_trait(?Send)]
pub trait ToApub {
pub(crate) trait ToApub {
type ApubType;
async fn to_apub(&self, pool: &DbPool) -> Result<Self::ApubType, LemmyError>;
fn to_tombstone(&self) -> Result<Tombstone, LemmyError>;
}
#[async_trait::async_trait(?Send)]
pub trait FromApub {
pub(crate) trait FromApub {
type ApubType;
/// Converts an object from ActivityPub type to Lemmy internal type.
///
@ -248,7 +248,7 @@ pub trait ActorType {
/// Store a sent or received activity in the database, for logging purposes. These records are not
/// persistent.
pub async fn insert_activity<T>(
pub(crate) async fn insert_activity<T>(
ap_id: &Url,
activity: T,
local: bool,