chore: add Makefile with check/fmt/clippy/test/fix targets; apply rustfmt
This commit is contained in:
28
Makefile
Normal file
28
Makefile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
.DEFAULT_GOAL := check
|
||||||
|
|
||||||
|
# Run the full local check suite — same order as CI would.
|
||||||
|
check: fmt-check clippy test
|
||||||
|
@echo "✅ All checks passed"
|
||||||
|
|
||||||
|
# Apply rustfmt to all files.
|
||||||
|
fmt:
|
||||||
|
cargo fmt
|
||||||
|
|
||||||
|
# Check formatting without modifying files (CI-safe).
|
||||||
|
fmt-check:
|
||||||
|
cargo fmt --check
|
||||||
|
|
||||||
|
# Run Clippy and treat warnings as errors.
|
||||||
|
clippy:
|
||||||
|
cargo clippy -- -D warnings
|
||||||
|
|
||||||
|
# Run the test suite.
|
||||||
|
test:
|
||||||
|
cargo test
|
||||||
|
|
||||||
|
# Apply fmt + clippy auto-fixes in one shot.
|
||||||
|
fix:
|
||||||
|
cargo fmt
|
||||||
|
cargo clippy --fix --allow-dirty --allow-staged
|
||||||
|
|
||||||
|
.PHONY: check fmt fmt-check clippy test fix
|
||||||
@@ -55,10 +55,10 @@ impl Activity for FollowActivity {
|
|||||||
.ok()
|
.ok()
|
||||||
.flatten()
|
.flatten()
|
||||||
.is_some()
|
.is_some()
|
||||||
{
|
{
|
||||||
tracing::debug!(target = %target_url, "accepting follow for migrated actor URL");
|
tracing::debug!(target = %target_url, "accepting follow for migrated actor URL");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(Error::bad_request(anyhow::anyhow!(
|
Err(Error::bad_request(anyhow::anyhow!(
|
||||||
"follow target is not a local actor"
|
"follow target is not a local actor"
|
||||||
)))
|
)))
|
||||||
@@ -74,10 +74,10 @@ impl Activity for FollowActivity {
|
|||||||
.blocklist_repo
|
.blocklist_repo
|
||||||
.is_actor_blocked(target_user_id, self.actor.inner().as_str())
|
.is_actor_blocked(target_user_id, self.actor.inner().as_str())
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
tracing::info!(actor = %self.actor.inner(), "ignoring follow from blocked actor");
|
tracing::info!(actor = %self.actor.inner(), "ignoring follow from blocked actor");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let _follower = self.actor.dereference(data).await?;
|
let _follower = self.actor.dereference(data).await?;
|
||||||
let local_actor = self.object.dereference(data).await?;
|
let local_actor = self.object.dereference(data).await?;
|
||||||
data.follow_repo
|
data.follow_repo
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::repository::{
|
|||||||
ActivityRepository, ActorRepository, BlockedDomain, BlocklistRepository, FollowRepository,
|
ActivityRepository, ActorRepository, BlockedDomain, BlocklistRepository, FollowRepository,
|
||||||
Follower, FollowerStatus, FollowingStatus, RemoteActor,
|
Follower, FollowerStatus, FollowingStatus, RemoteActor,
|
||||||
};
|
};
|
||||||
use crate::user::{ApActorType, ApProfileField, ApUser, ApUserRepository};
|
use crate::user::{ApActorType, ApUser, ApUserRepository};
|
||||||
|
|
||||||
// ── ActivityRepository ────────────────────────────────────────────────────────
|
// ── ActivityRepository ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ pub enum ApVisibility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Actor type for AP serialization. Defaults to `Person`.
|
/// Actor type for AP serialization. Defaults to `Person`.
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
#[derive(Default)]
|
|
||||||
pub enum ApActorType {
|
pub enum ApActorType {
|
||||||
#[default]
|
#[default]
|
||||||
Person,
|
Person,
|
||||||
@@ -36,7 +35,6 @@ pub enum ApActorType {
|
|||||||
Group,
|
Group,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Resolved actor data returned by [`crate::service::ActivityPubService::lookup_actor_by_handle`].
|
/// Resolved actor data returned by [`crate::service::ActivityPubService::lookup_actor_by_handle`].
|
||||||
/// Fetched via a signed HTTP request so strict instances (e.g. Threads) return full data.
|
/// Fetched via a signed HTTP request so strict instances (e.g. Threads) return full data.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|||||||
Reference in New Issue
Block a user