untested hashtag boost
This commit is contained in:
+41
-2
@@ -33,6 +33,8 @@ pub(crate) struct GroupConfig {
|
||||
acct: String,
|
||||
/// elefren data
|
||||
appdata: AppData,
|
||||
/// 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
|
||||
admin_users: HashSet<String>,
|
||||
/// List of users allowed to post to the group, if it is member-only
|
||||
@@ -43,9 +45,10 @@ pub(crate) struct GroupConfig {
|
||||
member_only: bool,
|
||||
/// Banned domain names, e.g. kiwifarms.cc
|
||||
banned_servers: HashSet<String>,
|
||||
/// Last seen notification timestamp
|
||||
/// Last seen notification timestamp (millis)
|
||||
last_notif_ts: u64,
|
||||
|
||||
/// Last seen status timestamp (millis)
|
||||
last_status_ts: u64,
|
||||
#[serde(skip)]
|
||||
dirty: bool,
|
||||
}
|
||||
@@ -62,12 +65,14 @@ impl Default for GroupConfig {
|
||||
redirect: Default::default(),
|
||||
token: Default::default(),
|
||||
},
|
||||
group_tags: Default::default(),
|
||||
admin_users: Default::default(),
|
||||
member_users: Default::default(),
|
||||
banned_users: Default::default(),
|
||||
member_only: false,
|
||||
banned_servers: Default::default(),
|
||||
last_notif_ts: 0,
|
||||
last_status_ts: 0,
|
||||
dirty: false,
|
||||
}
|
||||
}
|
||||
@@ -86,10 +91,12 @@ impl GroupConfig {
|
||||
self.enabled
|
||||
}
|
||||
|
||||
/*
|
||||
pub(crate) fn set_enabled(&mut self, ena: bool) {
|
||||
self.enabled = ena;
|
||||
self.mark_dirty();
|
||||
}
|
||||
*/
|
||||
|
||||
pub(crate) fn get_appdata(&self) -> &AppData {
|
||||
&self.appdata
|
||||
@@ -108,6 +115,10 @@ impl GroupConfig {
|
||||
self.member_users.iter()
|
||||
}
|
||||
|
||||
pub(crate) fn get_tags(&self) -> impl Iterator<Item = &String> {
|
||||
self.group_tags.iter()
|
||||
}
|
||||
|
||||
pub(crate) fn set_last_notif(&mut self, ts: u64) {
|
||||
self.last_notif_ts = self.last_notif_ts.max(ts);
|
||||
self.mark_dirty();
|
||||
@@ -117,6 +128,15 @@ impl GroupConfig {
|
||||
self.last_notif_ts
|
||||
}
|
||||
|
||||
pub(crate) fn set_last_status(&mut self, ts: u64) {
|
||||
self.last_status_ts = self.last_status_ts.max(ts);
|
||||
self.mark_dirty();
|
||||
}
|
||||
|
||||
pub(crate) fn get_last_status(&self) -> u64 {
|
||||
self.last_status_ts
|
||||
}
|
||||
|
||||
pub(crate) fn get_acct(&self) -> &str {
|
||||
&self.acct
|
||||
}
|
||||
@@ -129,6 +149,11 @@ impl GroupConfig {
|
||||
self.member_users.contains(acct)
|
||||
}
|
||||
|
||||
pub(crate) fn is_member_or_admin(&self, acct: &str) -> bool {
|
||||
self.is_member(acct)
|
||||
|| self.is_admin(acct)
|
||||
}
|
||||
|
||||
pub(crate) fn is_banned(&self, acct: &str) -> bool {
|
||||
self.banned_users.contains(acct) || self.is_users_server_banned(acct)
|
||||
}
|
||||
@@ -205,6 +230,20 @@ impl GroupConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn add_tag(&mut self, tag: &str) {
|
||||
self.group_tags.insert(tag.to_string());
|
||||
self.mark_dirty();
|
||||
}
|
||||
|
||||
pub(crate) fn remove_tag(&mut self, tag: &str) {
|
||||
self.group_tags.remove(tag);
|
||||
self.mark_dirty();
|
||||
}
|
||||
|
||||
pub(crate) fn is_tag_followed(&self, tag: &str) -> bool {
|
||||
self.group_tags.contains(tag)
|
||||
}
|
||||
|
||||
pub(crate) fn set_member_only(&mut self, member_only: bool) {
|
||||
self.member_only = member_only;
|
||||
self.mark_dirty();
|
||||
|
||||
Reference in New Issue
Block a user