make errors nicer, update the update_at column in feeds on modification
This commit is contained in:
parent
e7f0a58c8a
commit
c1434f64b9
2 changed files with 5 additions and 5 deletions
|
|
@ -245,7 +245,7 @@ impl BlogdorTheAggregator {
|
|||
};
|
||||
let user = user.added_by;
|
||||
for post in posts.iter() {
|
||||
let body = post.body.as_deref().unwrap_or("Blogdor Says: NO BODY!");
|
||||
let body = post.body.as_deref().unwrap_or("");
|
||||
|
||||
let tail = if body.len() < ZULIP_MESSAGE_CUTOFF {
|
||||
""
|
||||
|
|
@ -373,14 +373,14 @@ async fn check_feed(
|
|||
.first()
|
||||
.cloned()
|
||||
.map(|l| l.href)
|
||||
.unwrap_or("Blogdor Says: NO POST URL".to_string()),
|
||||
.unwrap_or("<url not found>".to_string()),
|
||||
feed_id,
|
||||
feed_url: url.clone(),
|
||||
title: post
|
||||
.title
|
||||
.clone()
|
||||
.map(|t| t.content)
|
||||
.unwrap_or("Blogdor Says: NO POST TITLE".to_string()),
|
||||
.unwrap_or("<no title found>".to_string()),
|
||||
published: post.posted().unwrap_or(now),
|
||||
received: now,
|
||||
feed_description: feed.description.to_owned().map(|d| d.content),
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ async fn handle_manage_feed(
|
|||
|
||||
async fn remove_feed(db: &SqlitePool, user: u32, feed: &str) -> Result<(), String> {
|
||||
sqlx::query!(
|
||||
"update feeds set active = false where url = ? and added_by = ?",
|
||||
"update feeds set active = false, updated_at = current_timestamp where url = ? and added_by = ?",
|
||||
feed,
|
||||
user
|
||||
)
|
||||
|
|
@ -162,7 +162,7 @@ async fn remove_feed(db: &SqlitePool, user: u32, feed: &str) -> Result<(), Strin
|
|||
async fn add_feed(db: &SqlitePool, user: u32, feed: &str) -> Result<(), String> {
|
||||
add_user(db, user).await?;
|
||||
sqlx::query!(
|
||||
"update feeds set active = true where url = ? and added_by = ?",
|
||||
"update feeds set active = true, updated_at = current_timestamp where url = ? and added_by = ?",
|
||||
feed,
|
||||
user
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue