Restrict module visibility and remove dead code

This commit is contained in:
silverpill 2022-10-02 17:49:48 +00:00
parent 7fdf1e7400
commit 93ebdfadd4
3 changed files with 5 additions and 57 deletions

View file

@ -10,9 +10,9 @@ mod http_signatures;
mod ipfs;
pub mod logger;
pub mod mastodon_api;
pub mod models;
pub mod monero;
mod models;
mod monero;
pub mod nodeinfo;
pub mod scheduler;
pub mod utils;
mod utils;
pub mod webfinger;

View file

@ -415,37 +415,6 @@ pub async fn get_local_timeline(
Ok(posts)
}
pub async fn get_posts(
db_client: &impl GenericClient,
posts_ids: Vec<Uuid>,
) -> Result<Vec<Post>, DatabaseError> {
let statement = format!(
"
SELECT
post, actor_profile,
{related_attachments},
{related_mentions},
{related_tags},
{related_links}
FROM post
JOIN actor_profile ON post.author_id = actor_profile.id
WHERE post.id = ANY($1)
",
related_attachments=RELATED_ATTACHMENTS,
related_mentions=RELATED_MENTIONS,
related_tags=RELATED_TAGS,
related_links=RELATED_LINKS,
);
let rows = db_client.query(
statement.as_str(),
&[&posts_ids],
).await?;
let posts: Vec<Post> = rows.iter()
.map(Post::try_from)
.collect::<Result<_, _>>()?;
Ok(posts)
}
pub async fn get_related_posts(
db_client: &impl GenericClient,
posts_ids: Vec<Uuid>,

View file

@ -238,24 +238,6 @@ pub async fn get_follow_request_by_id(
Ok(request)
}
pub async fn get_follow_request_by_path(
db_client: &impl GenericClient,
source_id: &Uuid,
target_id: &Uuid,
) -> Result<DbFollowRequest, DatabaseError> {
let maybe_row = db_client.query_opt(
"
SELECT follow_request
FROM follow_request
WHERE source_id = $1 AND target_id = $2
",
&[&source_id, &target_id],
).await?;
let row = maybe_row.ok_or(DatabaseError::NotFound("follow request"))?;
let request: DbFollowRequest = row.try_get("follow_request")?;
Ok(request)
}
pub async fn get_followers(
db_client: &impl GenericClient,
profile_id: &Uuid,
@ -557,11 +539,8 @@ mod tests {
assert!(following.is_empty());
// Accept follow request
follow_request_accepted(db_client, &follow_request.id).await.unwrap();
let follow_request = get_follow_request_by_path(
db_client,
&source.id,
&target.id,
).await.unwrap();
let follow_request = get_follow_request_by_id(db_client, &follow_request.id)
.await.unwrap();
assert!(matches!(
follow_request.request_status,
FollowRequestStatus::Accepted,