Fix new post read/unread handling
This commit is contained in:
parent
a9e6120f81
commit
e73f70af8f
@ -41,6 +41,7 @@ pub enum Thread {
|
||||
#[derive(Debug, SimpleObject)]
|
||||
pub struct NewsPost {
|
||||
pub thread_id: String,
|
||||
pub is_read: bool,
|
||||
pub slug: String,
|
||||
pub site: String,
|
||||
pub title: String,
|
||||
|
||||
@ -207,6 +207,7 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result<Thread, ServerEr
|
||||
}
|
||||
}
|
||||
let title = clean_title(&r.title.unwrap_or("NO TITLE".to_string())).await?;
|
||||
let is_read = r.is_read.unwrap_or(false);
|
||||
let timestamp = r
|
||||
.date
|
||||
.expect("post missing date")
|
||||
@ -214,6 +215,7 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result<Thread, ServerEr
|
||||
.unix_timestamp();
|
||||
Ok(Thread::News(NewsPost {
|
||||
thread_id,
|
||||
is_read,
|
||||
slug,
|
||||
site,
|
||||
title,
|
||||
|
||||
@ -878,6 +878,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"args": [],
|
||||
"deprecationReason": null,
|
||||
"description": null,
|
||||
"isDeprecated": false,
|
||||
"name": "isRead",
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "SCALAR",
|
||||
"name": "Boolean",
|
||||
"ofType": null
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"args": [],
|
||||
"deprecationReason": null,
|
||||
|
||||
@ -2,6 +2,7 @@ query ShowThreadQuery($threadId: String!) {
|
||||
thread(threadId: $threadId) {
|
||||
__typename ... on NewsPost{
|
||||
threadId
|
||||
isRead
|
||||
slug
|
||||
site
|
||||
title
|
||||
|
||||
@ -1131,9 +1131,7 @@ fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg>
|
||||
let avatar: Option<String> = None;
|
||||
//let avatar: Option<String> = Some(String::from("https://bulma.io/images/placeholders/64x64.png"));
|
||||
let id = post.thread_id.clone();
|
||||
// TODO: plumb this through
|
||||
//let is_unread = has_unread(&msg.tags);
|
||||
let is_unread = true;
|
||||
let is_unread = !post.is_read;
|
||||
let img = render_avatar(avatar, &from);
|
||||
article![
|
||||
C!["media"],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user