chore: add pre-commit fmt+clippy hooks, fix clippy warnings
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user