only show public quotes to logged out users
This commit is contained in:
@@ -113,6 +113,20 @@ impl Quote {
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
pub fn get_newest_public(conn: &Connection) -> Result<Option<Quote>, QuoteError> {
|
||||
let id: Option<Uuid> = conn
|
||||
.query_row(
|
||||
"SELECT id FROM quotes ORDER BY id DESC LIMIT 1 WHERE public = 1",
|
||||
(),
|
||||
|r| r.get(0),
|
||||
)
|
||||
.optional()?;
|
||||
|
||||
match id {
|
||||
Some(id) => Ok(Some(Self::get_by_id(conn, id)?)),
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
pub fn get_chronological_offset(
|
||||
conn: &Connection,
|
||||
offset: i64,
|
||||
|
||||
Reference in New Issue
Block a user