diff --git a/giterated-daemon/src/database_backend/handler.rs b/giterated-daemon/src/database_backend/handler.rs index ac64e02..ac35403 100644 --- a/giterated-daemon/src/database_backend/handler.rs +++ b/giterated-daemon/src/database_backend/handler.rs @@ -170,7 +170,6 @@ pub async fn repository_file_from_id( state: DatabaseBackend, OperationState(operation_state): OperationState, backend: GiteratedStack, - requester: Option, ) -> Result> { let object = backend diff --git a/giterated-daemon/src/database_backend/mod.rs b/giterated-daemon/src/database_backend/mod.rs index 44b6f05..7c55f7a 100644 --- a/giterated-daemon/src/database_backend/mod.rs +++ b/giterated-daemon/src/database_backend/mod.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use anyhow::Context; use giterated_models::instance::Instance; -use giterated_models::repository::{DefaultBranch, Description, Repository, Visibility}; +use giterated_models::repository::{DefaultBranch, Description, Repository, Visibility, CommitBodyType}; use giterated_models::user::{Bio, DisplayName, User}; use giterated_stack::provider::MetadataProvider; use giterated_stack::{AnyObject, AnySetting, GiteratedStack, ObjectMeta, SubstackBuilder}; @@ -73,7 +73,8 @@ impl DatabaseBackend { .value_setting::() .value_setting::() .value_setting::() - .value_setting::(); + .value_setting::() + .value_setting::(); // builder.value(repository_latest_commit); diff --git a/giterated-models/src/repository/mod.rs b/giterated-models/src/repository/mod.rs index 2eb9579..cd5f87b 100644 --- a/giterated-models/src/repository/mod.rs +++ b/giterated-models/src/repository/mod.rs @@ -421,6 +421,19 @@ impl From> for CommitSignature { } } +/// The document type of a [`Commit`]'s body +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub enum CommitBodyType { + Plain, + Markdown, +} + +impl Default for CommitBodyType { + fn default() -> Self { + Self::Plain + } +} + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct RepositorySummary { pub repository: Repository, diff --git a/giterated-models/src/repository/settings.rs b/giterated-models/src/repository/settings.rs index 98f12c6..04a97ae 100644 --- a/giterated-models/src/repository/settings.rs +++ b/giterated-models/src/repository/settings.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::{settings::Setting, user::User}; -use super::DefaultBranch; +use super::{DefaultBranch, CommitBodyType}; impl Setting for DefaultBranch { fn name() -> &'static str { @@ -20,3 +20,9 @@ impl Setting for AccessList { "access_list" } } + +impl Setting for CommitBodyType { + fn name() -> &'static str { + "commit_body_type" + } +} diff --git a/giterated-models/src/repository/values.rs b/giterated-models/src/repository/values.rs index e55dd49..a8d73e3 100644 --- a/giterated-models/src/repository/values.rs +++ b/giterated-models/src/repository/values.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::{settings::Setting, value::GiteratedObjectValue}; -use super::{Commit, Repository, RepositoryVisibility}; +use super::{Commit, Repository, RepositoryVisibility, CommitBodyType}; // pub struct RepositorySetting(pub V); @@ -89,3 +89,11 @@ impl GiteratedObjectValue for LatestCommit { "latest_commit" } } + +impl GiteratedObjectValue for CommitBodyType { + type Object = Repository; + + fn value_name() -> &'static str { + "commit_body_type" + } +}