Remove 'Pretty' variants.
This commit is contained in:
parent
fc83d56c0c
commit
8b04bd8059
@ -4,7 +4,7 @@ extern crate rocket;
|
||||
use std::{error::Error, io::Cursor, str::FromStr};
|
||||
|
||||
use glog::Flags;
|
||||
use notmuch::{Notmuch, NotmuchError, SearchSummary, ThreadSet};
|
||||
use notmuch::{Notmuch, NotmuchError, ThreadSet};
|
||||
use rocket::{
|
||||
http::{ContentType, Header},
|
||||
request::Request,
|
||||
@ -51,15 +51,6 @@ async fn search(
|
||||
Ok(Json(res))
|
||||
}
|
||||
|
||||
#[get("/show/<query>/pretty")]
|
||||
async fn show_pretty(
|
||||
nm: &State<Notmuch>,
|
||||
query: &str,
|
||||
) -> Result<Json<ThreadSet>, Debug<NotmuchError>> {
|
||||
let res = nm.show(query)?;
|
||||
Ok(Json(res))
|
||||
}
|
||||
|
||||
#[get("/show/<query>")]
|
||||
async fn show(nm: &State<Notmuch>, query: &str) -> Result<Json<ThreadSet>, Debug<NotmuchError>> {
|
||||
let res = nm.show(query)?;
|
||||
@ -153,7 +144,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
refresh,
|
||||
search_all,
|
||||
search,
|
||||
show_pretty,
|
||||
show
|
||||
],
|
||||
)
|
||||
|
||||
@ -11,9 +11,6 @@ pub fn search(query: &str, page: usize, results_per_page: usize) -> String {
|
||||
pub fn show(tid: &str) -> String {
|
||||
format!("{BASE_URL}/show/{tid}")
|
||||
}
|
||||
pub fn show_pretty(tid: &str) -> String {
|
||||
format!("{BASE_URL}/show/{tid}/pretty")
|
||||
}
|
||||
pub fn original(message_id: &str) -> String {
|
||||
format!("{BASE_URL}/original/{message_id}")
|
||||
}
|
||||
|
||||
@ -8,8 +8,8 @@ use std::{
|
||||
|
||||
use itertools::Itertools;
|
||||
use log::{debug, error, info, Level};
|
||||
use nm::view_thread;
|
||||
use notmuch::{Content, Part, Thread, ThreadNode, ThreadSet};
|
||||
use nm::{show_request, view_thread};
|
||||
use notmuch::ThreadSet;
|
||||
use seed::{prelude::*, *};
|
||||
use wasm_timer::Instant;
|
||||
|
||||
@ -41,7 +41,7 @@ fn on_url_changed(uc: subs::UrlChanged) -> Msg {
|
||||
);
|
||||
let hpp = url.remaining_hash_path_parts();
|
||||
match hpp.as_slice() {
|
||||
["t", tid] => Msg::ShowPrettyRequest(tid.to_string()),
|
||||
["t", tid] => Msg::ShowRequest(tid.to_string()),
|
||||
["s", query] => {
|
||||
let query = Url::decode_uri_component(query).unwrap_or("".to_string());
|
||||
Msg::SearchRequest {
|
||||
@ -126,8 +126,8 @@ pub enum Msg {
|
||||
results_per_page: usize,
|
||||
},
|
||||
SearchResult(fetch::Result<shared::SearchResult>),
|
||||
ShowPrettyRequest(String),
|
||||
ShowPrettyResult(fetch::Result<ThreadSet>),
|
||||
ShowRequest(String),
|
||||
ShowResult(fetch::Result<ThreadSet>),
|
||||
NextPage,
|
||||
PreviousPage,
|
||||
}
|
||||
@ -177,16 +177,16 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
error!("fetch failed {:?}", fetch_error);
|
||||
}
|
||||
|
||||
Msg::ShowPrettyRequest(tid) => {
|
||||
Msg::ShowRequest(tid) => {
|
||||
orders
|
||||
.skip()
|
||||
.perform_cmd(async move { Msg::ShowPrettyResult(show_pretty_request(&tid).await) });
|
||||
.perform_cmd(async move { Msg::ShowResult(show_request(&tid).await) });
|
||||
}
|
||||
Msg::ShowPrettyResult(Ok(response_data)) => {
|
||||
Msg::ShowResult(Ok(response_data)) => {
|
||||
debug!("fetch ok {:#?}", response_data);
|
||||
model.context = Context::Thread(response_data);
|
||||
}
|
||||
Msg::ShowPrettyResult(Err(fetch_error)) => {
|
||||
Msg::ShowResult(Err(fetch_error)) => {
|
||||
error!("fetch failed {:?}", fetch_error);
|
||||
}
|
||||
Msg::NextPage => {
|
||||
@ -236,16 +236,6 @@ async fn refresh_request() -> fetch::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn show_pretty_request(tid: &str) -> fetch::Result<ThreadSet> {
|
||||
Request::new(api::show_pretty(tid))
|
||||
.method(Method::Get)
|
||||
.fetch()
|
||||
.await?
|
||||
.check_status()?
|
||||
.json()
|
||||
.await
|
||||
}
|
||||
|
||||
// ------ ------
|
||||
// View
|
||||
// ------ ------
|
||||
@ -323,7 +313,7 @@ fn view_mobile_search_results(query: &str, search_results: &shared::SearchResult
|
||||
],
|
||||
td![C!["subject"], tags_chiclet(&r.tags), " ", &r.subject],
|
||||
td![C!["date"], &r.date_relative],
|
||||
ev(Ev::Click, move |_| Msg::ShowPrettyRequest(tid)),
|
||||
ev(Ev::Click, move |_| Msg::ShowRequest(tid)),
|
||||
]
|
||||
*/
|
||||
let tid = r.thread.clone();
|
||||
@ -331,7 +321,7 @@ fn view_mobile_search_results(query: &str, search_results: &shared::SearchResult
|
||||
div![
|
||||
C!["subject"],
|
||||
&r.subject,
|
||||
ev(Ev::Click, move |_| Msg::ShowPrettyRequest(tid)),
|
||||
ev(Ev::Click, move |_| Msg::ShowRequest(tid)),
|
||||
],
|
||||
div![
|
||||
span![C!["from"], pretty_authors(&r.authors)],
|
||||
|
||||
@ -4,7 +4,7 @@ use serde::de::Deserialize;
|
||||
|
||||
use crate::{api, set_title, Msg};
|
||||
|
||||
async fn show_request(tid: &str) -> fetch::Result<ThreadSet> {
|
||||
pub async fn show_request(tid: &str) -> fetch::Result<ThreadSet> {
|
||||
let b = Request::new(api::show(tid))
|
||||
.method(Method::Get)
|
||||
.fetch()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user