Compare commits

..

2 Commits

Author SHA1 Message Date
30c8a17168 clean up
Some checks failed
test / unit (push) Has been cancelled
lint / lint (push) Has been cancelled
test / integration (push) Has been cancelled
2026-05-17 12:14:45 +02:00
6a8c8b1fb8 chore: add pre-commit fmt+clippy hooks, fix clippy warnings 2026-05-17 12:09:24 +02:00
15 changed files with 27 additions and 19 deletions

18
.claude/settings.json Normal file
View File

@@ -0,0 +1,18 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"if": "Bash(git commit*)",
"command": "cargo fmt --all 2>&1 && cargo clippy --workspace 2>&1 || echo '{\"continue\": false, \"stopReason\": \"cargo fmt or clippy failed — fix before committing\"}'",
"timeout": 120,
"statusMessage": "Running cargo fmt + clippy..."
}
]
}
]
}
}

View File

@@ -241,12 +241,12 @@ impl Activity for UndoActivity {
async fn verify(&self, _data: &Data<Self::DataType>) -> Result<(), Self::Error> {
// The actor undoing must be the same as the actor in the wrapped activity.
if let Some(inner_actor) = self.object.get("actor").and_then(|v| v.as_str()) {
if inner_actor != self.actor.inner().as_str() {
return Err(Error::bad_request(anyhow::anyhow!(
"Undo actor does not match inner activity actor"
)));
}
if let Some(inner_actor) = self.object.get("actor").and_then(|v| v.as_str())
&& inner_actor != self.actor.inner().as_str()
{
return Err(Error::bad_request(anyhow::anyhow!(
"Undo actor does not match inner activity actor"
)));
}
Ok(())
}

View File

@@ -1,4 +1,3 @@
use super::*;
use activitypub_base::ActivityPubRepository;

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::user::PgUserRepository;
use chrono::Utc;

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::test_helpers::seed_user;
use chrono::Utc;

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::test_helpers::seed_user_and_thought;
use chrono::Utc;

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::{thought::PgThoughtRepository, user::PgUserRepository};
use domain::{

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::test_helpers::seed_user;
use chrono::Utc;

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::test_helpers::seed_user_and_thought;
use chrono::Utc;

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::test_helpers;
use chrono::Utc;

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::{thought::PgThoughtRepository, user::PgUserRepository};
use domain::ports::{ThoughtRepository, UserWriter};

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::test_helpers::seed_user;
use domain::{

View File

@@ -1,4 +1,3 @@
use super::*;
use crate::user::PgUserRepository;
use domain::ports::UserWriter;

View File

@@ -1,4 +1,3 @@
use super::*;
use domain::{models::user::User, value_objects::*};

View File

@@ -135,7 +135,9 @@ pub async fn get_thought_view(
.find_by_id(&thought.user_id)
.await?
.ok_or(DomainError::NotFound)?;
let mut map = engagement.get_for_thoughts(&[id.clone()], viewer).await?;
let mut map = engagement
.get_for_thoughts(std::slice::from_ref(id), viewer)
.await?;
let (stats, viewer_ctx) = map.remove(id).unwrap_or((
EngagementStats {
like_count: 0,