Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Community post tags (part 2: API methods) #5389

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
phiresky committed Mar 6, 2025
commit 8450c104a8823e95c91fb61b7bc5c5d7baaa6326
2 changes: 1 addition & 1 deletion crates/api/src/community/tag.rs
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ pub async fn create_community_tag(
let tag_form = TagInsertForm {
display_name: data.display_name.clone(),
community_id: data.community_id,
ap_id: community.build_tag_ap_id(&data.display_name)?
ap_id: community.build_tag_ap_id(&data.display_name)?,
};

let tag = Tag::create(&mut context.pool(), &tag_form).await?;
12 changes: 10 additions & 2 deletions crates/utils/src/utils/validation.rs
Original file line number Diff line number Diff line change
@@ -199,8 +199,16 @@ pub fn site_or_community_description_length_check(description: &str) -> LemmyRes
}

pub fn tag_name_length_check(tag_name: &str) -> LemmyResult<()> {
min_length_check(tag_name, TAG_NAME_MIN_LENGTH, LemmyErrorType::InvalidTagName)?;
max_length_check(tag_name, TAG_NAME_MAX_LENGTH, LemmyErrorType::InvalidTagName)
min_length_check(
tag_name,
TAG_NAME_MIN_LENGTH,
LemmyErrorType::InvalidTagName,
)?;
max_length_check(
tag_name,
TAG_NAME_MAX_LENGTH,
LemmyErrorType::InvalidTagName,
)
}

/// Check minimum and maximum length of input string. If the string is too short or too long, the