Fix issues with the new inbox page

This commit is contained in:
Bnyro 2023-06-22 13:16:25 +02:00
parent 304a8991d1
commit ebd91c10af
3 changed files with 4 additions and 1 deletions

View File

@ -25,7 +25,7 @@ pub fn get_mentions(page: i64, unread_only: bool) -> std::result::Result<GetPers
sort: Some(CommentSortType::New), sort: Some(CommentSortType::New),
..Default::default() ..Default::default()
}; };
super::get("/user/mentions", &params) super::get("/user/mention", &params)
} }
pub fn get_replies(page: i64, unread_only: bool) -> std::result::Result<GetRepliesResponse, reqwest::Error> { pub fn get_replies(page: i64, unread_only: bool) -> std::result::Result<GetRepliesResponse, reqwest::Error> {

View File

@ -92,6 +92,7 @@ impl SimpleComponent for InboxPage {
let comments = match type_ { let comments = match type_ {
InboxType::Mentions => { InboxType::Mentions => {
if let Ok(response) = api::user::get_mentions(page, unread_only) { if let Ok(response) = api::user::get_mentions(page, unread_only) {
// It's just a different object, but its contents are exactly the same
let serialised = serde_json::to_string(&response.mentions).unwrap(); let serialised = serde_json::to_string(&response.mentions).unwrap();
serde_json::from_str(&serialised).ok() serde_json::from_str(&serialised).ok()
} else { None } } else { None }
@ -116,6 +117,7 @@ impl SimpleComponent for InboxPage {
sender.input(InboxInput::FetchInbox); sender.input(InboxInput::FetchInbox);
} }
InboxInput::UpdateInbox(comments) => { InboxInput::UpdateInbox(comments) => {
self.mentions.guard().clear();
for comment in comments { for comment in comments {
self.mentions.guard().push_back(comment); self.mentions.guard().push_back(comment);
} }

View File

@ -41,6 +41,7 @@ impl FactoryComponent for MentionRow {
set_margin_end: 10, set_margin_end: 10,
set_margin_start: 10, set_margin_start: 10,
set_margin_top: 10, set_margin_top: 10,
set_vexpand: false,
gtk::Label { gtk::Label {
set_label: &self.comment.post.name, set_label: &self.comment.post.name,