.route(web::get().to(route_get::<Search>)),
)
// Community
+ .service(
+ web::resource("/community")
+ .guard(guard::Post())
+ .wrap(rate_limit.post())
+ .route(web::post().to(route_post::<CreateCommunity>)),
+ )
.service(
web::scope("/community")
.wrap(rate_limit.message())
- .route("", web::post().to(route_post::<CreateCommunity>))
.route("", web::get().to(route_get::<GetCommunity>))
.route("", web::put().to(route_post::<EditCommunity>))
.route("/list", web::get().to(route_get::<ListCommunities>))
.then(|res, _, ctx| {
match res {
Ok(Ok(res)) => ctx.text(res),
- Ok(Err(e)) => error!("{}", e),
+ Ok(Err(e)) => match e {},
Err(e) => error!("{}", &e),
}
actix::fut::ready(())
/// The messages sent to websocket clients
#[derive(Serialize, Deserialize, Message)]
-#[rtype(result = "Result<String, failure::Error>")]
+#[rtype(result = "Result<String, std::convert::Infallible>")]
pub struct StandardMessage {
/// Id of the client session
pub id: ConnectionId,
match op2 {
UserOperation::Register => rate_limiter.register().wrap(ip, fut).await,
UserOperation::CreatePost => rate_limiter.post().wrap(ip, fut).await,
+ UserOperation::CreateCommunity => rate_limiter.post().wrap(ip, fut).await,
_ => rate_limiter.message().wrap(ip, fut).await,
}
}
/// Handler for Message message.
impl Handler<StandardMessage> for ChatServer {
- type Result = ResponseFuture<Result<String, failure::Error>>;
+ type Result = ResponseFuture<Result<String, std::convert::Infallible>>;
fn handle(&mut self, msg: StandardMessage, ctx: &mut Context<Self>) -> Self::Result {
let fut = self.parse_json_message(msg, ctx);