From 1092319f6ed0dc8f60fd2200117dc5f9b847fbf2 Mon Sep 17 00:00:00 2001 From: silverpill Date: Wed, 12 Apr 2023 20:01:41 +0000 Subject: [PATCH] Fix database query error in Create activity handler --- CHANGELOG.md | 4 ++++ mitra-models/src/relationships/queries.rs | 1 + mitra-models/src/users/queries.rs | 1 + 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cda8699..a9592af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Re-fetch object if `attributedTo` value doesn't match `actor` of `Create` activity. - Added actor validation to `Update(Note)` and `Undo(Follow)` handlers. +### Fixed + +- Fixed database query error in `Create` activity handler. + ## [1.20.0] - 2023-03-07 ### Added diff --git a/mitra-models/src/relationships/queries.rs b/mitra-models/src/relationships/queries.rs index b82d935..f72cac5 100644 --- a/mitra-models/src/relationships/queries.rs +++ b/mitra-models/src/relationships/queries.rs @@ -360,6 +360,7 @@ pub async fn has_local_followers( WHERE actor_profile.actor_id = $1 AND relationship_type = $2 + LIMIT 1 ", &[&actor_id, &RelationshipType::Follow] ).await?; diff --git a/mitra-models/src/users/queries.rs b/mitra-models/src/users/queries.rs index 6227a39..7047a59 100644 --- a/mitra-models/src/users/queries.rs +++ b/mitra-models/src/users/queries.rs @@ -92,6 +92,7 @@ pub async fn create_user( SELECT 1 FROM user_account JOIN actor_profile USING (id) WHERE actor_profile.username ILIKE $1 + LIMIT 1 ", &[&user_data.username], ).await?;