Merge branch 'refactor/protocol-split_networked-local-unification' of ssh://15.204.248.232:/home/giterated/repositories/giterated.dev/ambee/giterated into refactor/protocol-split_networked-local-unification
parent: tbd commit: 50724f6
Showing 5 changed files with 32 insertions and 5 deletions
giterated-daemon/src/database_backend/handler.rs
@@ -170,7 +170,6 @@ pub async fn repository_file_from_id( | ||
170 | 170 | state: DatabaseBackend, |
171 | 171 | OperationState(operation_state): OperationState<StackOperationState>, |
172 | 172 | backend: GiteratedStack, |
173 | ||
174 | 173 | requester: Option<AuthenticatedUser>, |
175 | 174 | ) -> Result<RepositoryFile, OperationError<RepositoryError>> { |
176 | 175 | let object = backend |
giterated-daemon/src/database_backend/mod.rs
@@ -7,7 +7,7 @@ use std::sync::Arc; | ||
7 | 7 | use anyhow::Context; |
8 | 8 | |
9 | 9 | use giterated_models::instance::Instance; |
10 | use giterated_models::repository::{DefaultBranch, Description, Repository, Visibility}; | |
10 | use giterated_models::repository::{DefaultBranch, Description, Repository, Visibility, CommitBodyType}; | |
11 | 11 | use giterated_models::user::{Bio, DisplayName, User}; |
12 | 12 | use giterated_stack::provider::MetadataProvider; |
13 | 13 | use giterated_stack::{AnyObject, AnySetting, GiteratedStack, ObjectMeta, SubstackBuilder}; |
@@ -73,7 +73,8 @@ impl DatabaseBackend { | ||
73 | 73 | .value_setting::<User, Bio>() |
74 | 74 | .value_setting::<Repository, Description>() |
75 | 75 | .value_setting::<Repository, Visibility>() |
76 | .value_setting::<Repository, DefaultBranch>(); | |
76 | .value_setting::<Repository, DefaultBranch>() | |
77 | .value_setting::<Repository, CommitBodyType>(); | |
77 | 78 | |
78 | 79 | // builder.value(repository_latest_commit); |
79 | 80 |
giterated-models/src/repository/mod.rs
@@ -421,6 +421,19 @@ impl From<git2::Signature<'_>> for CommitSignature { | ||
421 | 421 | } |
422 | 422 | } |
423 | 423 | |
424 | /// The document type of a [`Commit`]'s body | |
425 | #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] | |
426 | pub enum CommitBodyType { | |
427 | Plain, | |
428 | Markdown, | |
429 | } | |
430 | ||
431 | impl Default for CommitBodyType { | |
432 | fn default() -> Self { | |
433 | Self::Plain | |
434 | } | |
435 | } | |
436 | ||
424 | 437 | #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] |
425 | 438 | pub struct RepositorySummary { |
426 | 439 | pub repository: Repository, |
giterated-models/src/repository/settings.rs
@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; | ||
2 | 2 | |
3 | 3 | use crate::{settings::Setting, user::User}; |
4 | 4 | |
5 | use super::DefaultBranch; | |
5 | use super::{DefaultBranch, CommitBodyType}; | |
6 | 6 | |
7 | 7 | impl Setting for DefaultBranch { |
8 | 8 | fn name() -> &'static str { |
@@ -20,3 +20,9 @@ impl Setting for AccessList { | ||
20 | 20 | "access_list" |
21 | 21 | } |
22 | 22 | } |
23 | ||
24 | impl Setting for CommitBodyType { | |
25 | fn name() -> &'static str { | |
26 | "commit_body_type" | |
27 | } | |
28 | } |
giterated-models/src/repository/values.rs
@@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; | ||
4 | 4 | |
5 | 5 | use crate::{settings::Setting, value::GiteratedObjectValue}; |
6 | 6 | |
7 | use super::{Commit, Repository, RepositoryVisibility}; | |
7 | use super::{Commit, Repository, RepositoryVisibility, CommitBodyType}; | |
8 | 8 | |
9 | 9 | // pub struct RepositorySetting<V: GiteratedObjectValue>(pub V); |
10 | 10 | |
@@ -89,3 +89,11 @@ impl GiteratedObjectValue for LatestCommit { | ||
89 | 89 | "latest_commit" |
90 | 90 | } |
91 | 91 | } |
92 | ||
93 | impl GiteratedObjectValue for CommitBodyType { | |
94 | type Object = Repository; | |
95 | ||
96 | fn value_name() -> &'static str { | |
97 | "commit_body_type" | |
98 | } | |
99 | } |