Button to mark all as read in the inbox
This commit is contained in:
parent
1ebfa7776f
commit
4326c7d4d6
|
@ -24,7 +24,8 @@ pub enum InboxInput {
|
||||||
UpdateType(InboxType),
|
UpdateType(InboxType),
|
||||||
ToggleUnreadState,
|
ToggleUnreadState,
|
||||||
FetchInbox,
|
FetchInbox,
|
||||||
UpdateInbox(Vec<CommentReplyView>)
|
UpdateInbox(Vec<CommentReplyView>),
|
||||||
|
MarkAllAsRead,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[relm4::component(pub)]
|
#[relm4::component(pub)]
|
||||||
|
@ -53,6 +54,10 @@ impl SimpleComponent for InboxPage {
|
||||||
set_label: "Show unread only",
|
set_label: "Show unread only",
|
||||||
connect_clicked => InboxInput::ToggleUnreadState,
|
connect_clicked => InboxInput::ToggleUnreadState,
|
||||||
},
|
},
|
||||||
|
gtk::Button {
|
||||||
|
set_label: "Mark all as read",
|
||||||
|
connect_clicked => InboxInput::MarkAllAsRead,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
gtk::ScrolledWindow {
|
gtk::ScrolledWindow {
|
||||||
#[local_ref]
|
#[local_ref]
|
||||||
|
@ -115,6 +120,14 @@ impl SimpleComponent for InboxPage {
|
||||||
self.mentions.guard().push_back(comment);
|
self.mentions.guard().push_back(comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
InboxInput::MarkAllAsRead => {
|
||||||
|
let show_unread_only = self.unread_only.clone();
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
if api::user::mark_all_as_read().is_ok() && show_unread_only {
|
||||||
|
sender.input(InboxInput::UpdateInbox(vec![]));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue