v0.2.87
This commit is contained in:
1 parent
acfe926066
commit
df403c0aa7
26 files changed
+1502
-144
No files matched your search
+12
-33
@@ -288,13 +288,8 @@ pub async fn list_favorites(
|
||||
|
||||
for note in notes {
|
||||
if (note.private_resource != 0 || note.protected_resource != 0)
|
||||
&& !has_header_resource_access(
|
||||
&state,
|
||||
&headers,
|
||||
"workspace",
|
||||
¬e.workspace_slug,
|
||||
)
|
||||
.await?
|
||||
&& !has_header_resource_access(&state, &headers, "workspace", ¬e.workspace_slug)
|
||||
.await?
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -389,11 +384,7 @@ mod tests {
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert(
|
||||
header::COOKIE,
|
||||
HeaderValue::from_str(&format!(
|
||||
"{}={token}",
|
||||
crate::security::SESSION_COOKIE
|
||||
))
|
||||
.unwrap(),
|
||||
HeaderValue::from_str(&format!("{}={token}", crate::security::SESSION_COOKIE)).unwrap(),
|
||||
);
|
||||
(headers, user_id)
|
||||
}
|
||||
@@ -412,13 +403,9 @@ mod tests {
|
||||
};
|
||||
|
||||
for _ in 0..2 {
|
||||
let result = add_favorite(
|
||||
State(state.clone()),
|
||||
headers.clone(),
|
||||
Json(target()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let result = add_favorite(State(state.clone()), headers.clone(), Json(target()))
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(result.0.favorite);
|
||||
}
|
||||
|
||||
@@ -828,13 +815,9 @@ mod tests {
|
||||
workspace_slug: None,
|
||||
};
|
||||
|
||||
let anonymous = add_favorite(
|
||||
State(state.clone()),
|
||||
HeaderMap::new(),
|
||||
Json(target()),
|
||||
)
|
||||
.await
|
||||
.expect_err("anonymous favorite must fail");
|
||||
let anonymous = add_favorite(State(state.clone()), HeaderMap::new(), Json(target()))
|
||||
.await
|
||||
.expect_err("anonymous favorite must fail");
|
||||
assert_eq!(anonymous.into_response().status(), StatusCode::FORBIDDEN);
|
||||
|
||||
let (inactive_headers, user_id) = logged_in_headers(&state, "inactive").await;
|
||||
@@ -843,13 +826,9 @@ mod tests {
|
||||
.execute(state.db.pool())
|
||||
.await
|
||||
.unwrap();
|
||||
let inactive = add_favorite(
|
||||
State(state),
|
||||
inactive_headers,
|
||||
Json(target()),
|
||||
)
|
||||
.await
|
||||
.expect_err("inactive account favorite must fail");
|
||||
let inactive = add_favorite(State(state), inactive_headers, Json(target()))
|
||||
.await
|
||||
.expect_err("inactive account favorite must fail");
|
||||
assert_eq!(inactive.into_response().status(), StatusCode::FORBIDDEN);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user