You've already forked AstralRinth
forked from didirus/AstralRinth
Moderation + Mod Editing (#101)
* Moderation + Mod Editing WIP * Run prepare, fix perms * Make it compile * Finish moderation and edit routes * More fixes * Use better queries * Final Fixes
This commit is contained in:
@@ -58,7 +58,7 @@ pub struct Mod {
|
||||
/// Draft - Mod is not displayed on search, and not accessible by URL
|
||||
/// Unlisted - Mod is not displayed on search, but accessible by URL
|
||||
/// Processing - Mod is not displayed on search, and not accessible by URL (Temporary state, mod under review)
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ModStatus {
|
||||
Approved,
|
||||
@@ -103,6 +103,24 @@ impl ModStatus {
|
||||
ModStatus::Unknown => "unknown",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_hidden(&self) -> bool {
|
||||
match self {
|
||||
ModStatus::Approved => false,
|
||||
ModStatus::Rejected => true,
|
||||
ModStatus::Draft => true,
|
||||
ModStatus::Unlisted => false,
|
||||
ModStatus::Processing => true,
|
||||
ModStatus::Unknown => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_searchable(&self) -> bool {
|
||||
match self {
|
||||
ModStatus::Approved => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A specific version of a mod
|
||||
|
||||
@@ -45,4 +45,11 @@ impl Role {
|
||||
_ => Role::Developer,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_mod(&self) -> bool {
|
||||
match self {
|
||||
Role::Developer => false,
|
||||
Role::Moderator | Role::Admin => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user