Restrict module visibility and remove dead code
This commit is contained in:
parent
7fdf1e7400
commit
93ebdfadd4
3 changed files with 5 additions and 57 deletions
|
@ -10,9 +10,9 @@ mod http_signatures;
|
||||||
mod ipfs;
|
mod ipfs;
|
||||||
pub mod logger;
|
pub mod logger;
|
||||||
pub mod mastodon_api;
|
pub mod mastodon_api;
|
||||||
pub mod models;
|
mod models;
|
||||||
pub mod monero;
|
mod monero;
|
||||||
pub mod nodeinfo;
|
pub mod nodeinfo;
|
||||||
pub mod scheduler;
|
pub mod scheduler;
|
||||||
pub mod utils;
|
mod utils;
|
||||||
pub mod webfinger;
|
pub mod webfinger;
|
||||||
|
|
|
@ -415,37 +415,6 @@ pub async fn get_local_timeline(
|
||||||
Ok(posts)
|
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(
|
pub async fn get_related_posts(
|
||||||
db_client: &impl GenericClient,
|
db_client: &impl GenericClient,
|
||||||
posts_ids: Vec<Uuid>,
|
posts_ids: Vec<Uuid>,
|
||||||
|
|
|
@ -238,24 +238,6 @@ pub async fn get_follow_request_by_id(
|
||||||
Ok(request)
|
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(
|
pub async fn get_followers(
|
||||||
db_client: &impl GenericClient,
|
db_client: &impl GenericClient,
|
||||||
profile_id: &Uuid,
|
profile_id: &Uuid,
|
||||||
|
@ -557,11 +539,8 @@ mod tests {
|
||||||
assert!(following.is_empty());
|
assert!(following.is_empty());
|
||||||
// Accept follow request
|
// Accept follow request
|
||||||
follow_request_accepted(db_client, &follow_request.id).await.unwrap();
|
follow_request_accepted(db_client, &follow_request.id).await.unwrap();
|
||||||
let follow_request = get_follow_request_by_path(
|
let follow_request = get_follow_request_by_id(db_client, &follow_request.id)
|
||||||
db_client,
|
.await.unwrap();
|
||||||
&source.id,
|
|
||||||
&target.id,
|
|
||||||
).await.unwrap();
|
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
follow_request.request_status,
|
follow_request.request_status,
|
||||||
FollowRequestStatus::Accepted,
|
FollowRequestStatus::Accepted,
|
||||||
|
|
Loading…
Reference in a new issue