Skip to content

Commit 80111bf

Browse files
committed
Fix some feedback from the PR
1 parent 0ab6273 commit 80111bf

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

sentry/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<A: Adapter + 'static> Application<A> {
7777
Ok::<_, Error>(service_fn(move |req| {
7878
let adapter_config = adapter_config.clone();
7979
let redis = redis.clone();
80-
async move { Ok::<_, Error>(handle_routing(req, adapter_config, redis).await) }
80+
async move { Ok::<_, Error>(handle_routing(req, (&adapter_config.0, &adapter_config.1), redis).await) }
8181
}))
8282
}
8383
});
@@ -107,7 +107,7 @@ where
107107

108108
async fn handle_routing(
109109
req: Request<Body>,
110-
(adapter, config): (impl Adapter, Config),
110+
(adapter, config): (&impl Adapter, &Config),
111111
redis: SharedConnection,
112112
) -> Response<Body> {
113113
let headers = match cors(&req) {
@@ -117,9 +117,7 @@ async fn handle_routing(
117117
CorsResult::None => Default::default(),
118118
};
119119

120-
// otherwise problems with `.await` occurs about `Sync` being required for `Adapter`.
121-
let auth_connections = (adapter.clone(), redis.clone());
122-
let req = match auth::for_request(req, &auth_connections.0, auth_connections.1).await {
120+
let req = match auth::for_request(req, adapter, redis.clone()).await {
123121
Ok(req) => req,
124122
Err(response_error) => return map_response_error(response_error),
125123
};

sentry/src/middleware/auth.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ pub(crate) async fn for_request(
7373
req.extensions_mut().insert(session);
7474
}
7575

76-
// @TODO: Check if we actually need this since we have the `adapter` for the check: `channelIfActive`
77-
req.extensions_mut().insert(adapter.whoami().clone());
78-
7976
Ok(req)
8077
}
8178

@@ -95,7 +92,6 @@ mod test {
9592
use primitives::adapter::DummyAdapterOptions;
9693
use primitives::config::configuration;
9794
use primitives::util::tests::prep_db::{AUTH, IDS};
98-
use primitives::ValidatorId;
9995

10096
async fn setup() -> (DummyAdapter, SharedConnection) {
10197
let adapter_options = DummyAdapterOptions {
@@ -127,11 +123,6 @@ mod test {
127123
no_auth.extensions().get::<Session>().is_none(),
128124
"There shouldn't be a Session in the extensions"
129125
);
130-
assert_eq!(
131-
Some(dummy_adapter.whoami()),
132-
no_auth.extensions().get::<ValidatorId>(),
133-
"There should be the whoami() ValidatorId of the adapter in the extensions"
134-
);
135126

136127
// there is a Header, but it has wrong format
137128
let incorrect_auth_req = Request::builder()

sentry/src/routes/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::ResponseError;
99

1010
pub async fn handle_channel_routes(
1111
req: Request<Body>,
12-
adapter: impl Adapter,
12+
adapter: &impl Adapter,
1313
) -> Result<Response<Body>, ResponseError> {
1414
// Channel Creates
1515
if req.uri().path() == "/channel" && req.method() == Method::POST {

0 commit comments

Comments
 (0)