add: journal.css special note

This commit is contained in:
trisua 2025-06-19 19:13:07 -04:00
parent f0d1a1e8e4
commit dc50f3a8af
8 changed files with 125 additions and 13 deletions

View file

@ -70,7 +70,7 @@ impl DataManager {
Ok(res.unwrap())
}
const MAXIMUM_FREE_JOURNALS: usize = 15;
const MAXIMUM_FREE_JOURNALS: usize = 5;
/// Create a new journal in the database.
///

View file

@ -65,6 +65,8 @@ impl DataManager {
Ok(res.unwrap())
}
const MAXIMUM_FREE_NOTES_PER_JOURNAL: usize = 10;
/// Create a new note in the database.
///
/// # Arguments
@ -85,6 +87,20 @@ impl DataManager {
data.title = data.title.replace(" ", "_").to_lowercase();
// check number of notes
let owner = self.get_user_by_id(data.owner).await?;
if !owner.permissions.check(FinePermission::SUPPORTER) {
let journals = self.get_notes_by_journal(data.owner).await?;
if journals.len() >= Self::MAXIMUM_FREE_NOTES_PER_JOURNAL {
return Err(Error::MiscError(
"You already have the maximum number of notes you can have in this journal"
.to_string(),
));
}
}
// check name
let regex = regex::RegexBuilder::new(NAME_REGEX)
.multi_line(true)