feat: add visibility check for tagging in thought creation

This commit is contained in:
2025-09-07 15:15:24 +02:00
parent 5ce6d9f2da
commit 3d25ffca4f
2 changed files with 7 additions and 4 deletions

View File

@@ -35,10 +35,12 @@ pub async fn create_thought(
.insert(&txn)
.await?;
let tag_names = parse_hashtags(&params.content);
if !tag_names.is_empty() {
let tags = find_or_create_tags(&txn, tag_names).await?;
link_tags_to_thought(&txn, new_thought.id, tags).await?;
if new_thought.visibility == thought::Visibility::Public {
let tag_names = parse_hashtags(&params.content);
if !tag_names.is_empty() {
let tags = find_or_create_tags(&txn, tag_names).await?;
link_tags_to_thought(&txn, new_thought.id, tags).await?;
}
}
txn.commit().await?;