Refactor thread responses into an enum.
Lays ground work for different types of views, i.e. email, news, docs, etc.
This commit is contained in:
@@ -341,25 +341,28 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
let mut open_messages: HashSet<_> = data
|
||||
.thread
|
||||
.messages
|
||||
.iter()
|
||||
.filter(|msg| msg.tags.iter().any(|t| t == "unread"))
|
||||
.map(|msg| msg.id.clone())
|
||||
.collect();
|
||||
if open_messages.is_empty() {
|
||||
open_messages = data
|
||||
.thread
|
||||
.messages
|
||||
.iter()
|
||||
.map(|msg| msg.id.clone())
|
||||
.collect();
|
||||
match &data.thread {
|
||||
graphql::show_thread_query::ShowThreadQueryThread::EmailThread(
|
||||
ShowThreadQueryThreadOnEmailThread {
|
||||
thread_id,
|
||||
subject,
|
||||
messages,
|
||||
},
|
||||
) => {
|
||||
let mut open_messages: HashSet<_> = messages
|
||||
.iter()
|
||||
.filter(|msg| msg.tags.iter().any(|t| t == "unread"))
|
||||
.map(|msg| msg.id.clone())
|
||||
.collect();
|
||||
if open_messages.is_empty() {
|
||||
open_messages = messages.iter().map(|msg| msg.id.clone()).collect();
|
||||
}
|
||||
model.context = Context::ThreadResult {
|
||||
thread: data.thread,
|
||||
open_messages,
|
||||
};
|
||||
}
|
||||
}
|
||||
model.context = Context::ThreadResult {
|
||||
thread: data.thread,
|
||||
open_messages,
|
||||
};
|
||||
}
|
||||
Msg::ShowThreadResult(bad) => {
|
||||
error!("show_thread_query error: {bad:#?}");
|
||||
|
||||
Reference in New Issue
Block a user