wip smart split to fit instance character limit

This commit is contained in:
2021-09-18 21:55:16 +02:00
parent e5ce0bdeb7
commit 748023c410
3 changed files with 140 additions and 34 deletions
+7
View File
@@ -33,6 +33,8 @@ pub(crate) struct GroupConfig {
acct: String,
/// elefren data
appdata: AppData,
/// Server's character limit
character_limit: usize,
/// Hashtags the group will auto-boost from it's members
group_tags: HashSet<String>,
/// List of admin account "acct" names, e.g. piggo@piggo.space
@@ -67,6 +69,7 @@ impl Default for GroupConfig {
redirect: Default::default(),
token: Default::default(),
},
character_limit: 5000,
group_tags: Default::default(),
admin_users: Default::default(),
member_users: Default::default(),
@@ -90,6 +93,10 @@ impl GroupConfig {
}
}
pub(crate) fn get_character_limit(&self) -> usize {
self.character_limit
}
pub(crate) fn is_enabled(&self) -> bool {
self.enabled
}
-16
View File
@@ -232,19 +232,3 @@ fn make_scopes() -> Scopes {
| Scopes::write(scopes::Write::Media)
| Scopes::write(scopes::Write::Follows)
}
// trait TapOk<T> {
// fn tap_ok<F: FnOnce(&T)>(self, f: F) -> Self;
// }
//
// impl<T, E> TapOk<T> for Result<T, E> {
// fn tap_ok<F: FnOnce(&T)>(self, f: F) -> Self {
// match self {
// Ok(v) => {
// f(&v);
// Ok(v)
// }
// Err(e) => Err(e)
// }
// }
// }