Merge remote-tracking branch 'upstream/main' into optimize-get-random

This commit is contained in:
Dull Bananas 2024-12-19 13:45:45 -07:00
commit 856de24520
4 changed files with 8 additions and 8 deletions

View file

@ -42,7 +42,8 @@ pub async fn markdown_rewrite_remote_links(
let mut local_url = local_url.to_string(); let mut local_url = local_url.to_string();
// restore title // restore title
if let Some(extra) = extra { if let Some(extra) = extra {
local_url = format!("{local_url} {extra}"); local_url.push(' ');
local_url.push_str(extra);
} }
src.replace_range(start..end, local_url.as_str()); src.replace_range(start..end, local_url.as_str());
} }

View file

@ -454,7 +454,6 @@ fn build_item(
protocol_and_hostname: &str, protocol_and_hostname: &str,
) -> LemmyResult<Item> { ) -> LemmyResult<Item> {
// TODO add images // TODO add images
let author_url = format!("{protocol_and_hostname}/u/{creator_name}");
let guid = Some(Guid { let guid = Some(Guid {
permalink: true, permalink: true,
value: url.to_owned(), value: url.to_owned(),
@ -464,7 +463,8 @@ fn build_item(
Ok(Item { Ok(Item {
title: Some(format!("Reply from {creator_name}")), title: Some(format!("Reply from {creator_name}")),
author: Some(format!( author: Some(format!(
"/u/{creator_name} <a href=\"{author_url}\">(link)</a>" "/u/{creator_name} <a href=\"{}\">(link)</a>",
format_args!("{protocol_and_hostname}/u/{creator_name}")
)), )),
pub_date: Some(published.to_rfc2822()), pub_date: Some(published.to_rfc2822()),
comments: Some(url.to_owned()), comments: Some(url.to_owned()),

View file

@ -24,7 +24,8 @@ pub fn markdown_rewrite_image_links(mut src: String) -> (String, Vec<Url>) {
); );
// restore custom emoji format // restore custom emoji format
if let Some(extra) = extra { if let Some(extra) = extra {
proxied = format!("{proxied} {extra}"); proxied.push(' ');
proxied.push_str(extra);
} }
src.replace_range(start..end, &proxied); src.replace_range(start..end, &proxied);
} }

View file

@ -190,10 +190,8 @@ async fn process_ranks_in_batches(
UPDATE {aggregates_table} a {set_clause} UPDATE {aggregates_table} a {set_clause}
FROM batch WHERE a.{id_column} = batch.{id_column} RETURNING a.published; FROM batch WHERE a.{id_column} = batch.{id_column} RETURNING a.published;
"#, "#,
id_column = format!("{table_name}_id"), id_column = format_args!("{table_name}_id"),
aggregates_table = format!("{table_name}_aggregates"), aggregates_table = format_args!("{table_name}_aggregates"),
set_clause = set_clause,
where_clause = where_clause
)) ))
.bind::<Timestamptz, _>(previous_batch_last_published) .bind::<Timestamptz, _>(previous_batch_last_published)
.bind::<Integer, _>(update_batch_size) .bind::<Integer, _>(update_batch_size)