|
|
@ -80,13 +80,13 @@ fn get_feed_all_data(conn: &PgConnection, sort_type: &SortType) -> Result<String
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async fn get_feed(
|
|
|
|
async fn get_feed(
|
|
|
|
path: web::Path<(String, String)>,
|
|
|
|
web::Path((req_type, param)): web::Path<(String, String)>,
|
|
|
|
info: web::Query<Params>,
|
|
|
|
info: web::Query<Params>,
|
|
|
|
context: web::Data<LemmyContext>,
|
|
|
|
context: web::Data<LemmyContext>,
|
|
|
|
) -> Result<HttpResponse, Error> {
|
|
|
|
) -> Result<HttpResponse, Error> {
|
|
|
|
let sort_type = get_sort_type(info).map_err(ErrorBadRequest)?;
|
|
|
|
let sort_type = get_sort_type(info).map_err(ErrorBadRequest)?;
|
|
|
|
|
|
|
|
|
|
|
|
let request_type = match path.0.as_ref() {
|
|
|
|
let request_type = match req_type.as_str() {
|
|
|
|
"u" => RequestType::User,
|
|
|
|
"u" => RequestType::User,
|
|
|
|
"c" => RequestType::Community,
|
|
|
|
"c" => RequestType::Community,
|
|
|
|
"front" => RequestType::Front,
|
|
|
|
"front" => RequestType::Front,
|
|
|
@ -94,8 +94,6 @@ async fn get_feed(
|
|
|
|
_ => return Err(ErrorBadRequest(LemmyError::from(anyhow!("wrong_type")))),
|
|
|
|
_ => return Err(ErrorBadRequest(LemmyError::from(anyhow!("wrong_type")))),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let param = path.1.to_owned();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let builder = blocking(context.pool(), move |conn| match request_type {
|
|
|
|
let builder = blocking(context.pool(), move |conn| match request_type {
|
|
|
|
RequestType::User => get_feed_user(conn, &sort_type, param),
|
|
|
|
RequestType::User => get_feed_user(conn, &sort_type, param),
|
|
|
|
RequestType::Community => get_feed_community(conn, &sort_type, param),
|
|
|
|
RequestType::Community => get_feed_community(conn, &sort_type, param),
|
|
|
|