Extend logging for new posts
All checks were successful
Run Tests on Code / run-tests (push) Successful in 14s

This commit is contained in:
Neshura 2023-12-30 01:22:13 +01:00
parent c3ff578c57
commit 8be74585a0
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -176,7 +176,7 @@ async fn handle_series(
};
let post_data = CreatePost {
name: post_lemmy_info.title,
name: post_lemmy_info.title.clone(),
community_id,
url: Some(post_lemmy_info.url),
body: post_body,
@ -185,11 +185,15 @@ async fn handle_series(
language_id: Some(LanguageId(37)), // TODO get this id once every few hours per API request, the ordering of IDs suggests that the EN Id might change in the future
};
let info = format!("Posting '{}' to {}", post_lemmy_info.title.as_str(), post_series_config.name.as_str());
write_info(info);
let post_id = lemmy.post(post_data).await?;
{
let read = data.read().await;
if post_series_config.pin_settings.pin_new_post_community && !read.config.protected_communities.contains(&post_series_config.name) {
let info = format!("Pinning '{}' to {}", post_lemmy_info.title, post_series_config.name.as_str());
write_info(info);
let pinned_posts = lemmy.get_community_pinned(community_id).await?;
if !pinned_posts.is_empty() {
let community_pinned_post = &pinned_posts[0];
@ -204,6 +208,8 @@ async fn handle_series(
let read = data.read().await;
if post_series_config.pin_settings.pin_new_post_local {
let info = format!("Pinning '{}' to Instance", post_lemmy_info.title);
write_info(info);
let pinned_posts = lemmy.get_local_pinned().await?;
if !pinned_posts.is_empty() {
for pinned_post in pinned_posts {