We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
json!
1 parent 7c843f2 commit 263c2d1Copy full SHA for 263c2d1
src/controllers/krate/follow.rs
@@ -49,11 +49,8 @@ pub fn following(req: &mut dyn RequestExt) -> EndpointResult {
49
let user_id = req.authenticate()?.forbid_api_token_auth()?.user_id();
50
let conn = req.db_read_only()?;
51
let follow = follow_target(req, &conn, user_id)?;
52
- let following = diesel::select(exists(follows::table.find(follow.id()))).get_result(&*conn)?;
+ let following =
53
+ diesel::select(exists(follows::table.find(follow.id()))).get_result::<bool>(&*conn)?;
54
- #[derive(Serialize)]
55
- struct R {
56
- following: bool,
57
- }
58
- Ok(req.json(&R { following }))
+ Ok(req.json(&json!({ "following": following })))
59
}
0 commit comments