JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Fix LatestCommit

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨3ff68ad

Showing ⁨⁨3⁩ changed files⁩ with ⁨⁨20⁩ insertions⁩ and ⁨⁨20⁩ deletions⁩

giterated-daemon/src/database_backend/handler.rs

View file
@@ -396,3 +396,11 @@ pub async fn instance_create_repository_request(
396 396 .await
397 397 .as_internal_error()
398 398 }
399
400 pub async fn repository_latest_commit(
401 _repository: Repository,
402 _state: DatabaseBackend,
403 _operation_state: StackOperationState,
404 ) -> Result<LatestCommit, OperationError<RepositoryError>> {
405 Ok(LatestCommit(None))
406 }

giterated-daemon/src/database_backend/mod.rs

View file
@@ -25,7 +25,7 @@ use self::handler::{
25 25 instance_registration_request, repository_commit_before, repository_commit_by_id,
26 26 repository_diff, repository_diff_patch, repository_file_from_id, repository_file_from_path,
27 27 repository_get_branches, repository_get_statistics, repository_info,
28 repository_last_commit_of_file, user_get_repositories,
28 repository_last_commit_of_file, repository_latest_commit, user_get_repositories,
29 29 };
30 30
31 31 /// A backend implementation which attempts to resolve data from the instance's database.
@@ -75,6 +75,8 @@ impl DatabaseBackend {
75 75 .value_setting::<Repository, Visibility>()
76 76 .value_setting::<Repository, DefaultBranch>();
77 77
78 builder.value(repository_latest_commit);
79
78 80 builder
79 81 .operation(user_get_repositories)
80 82 .operation(instance_registration_request)

giterated-stack/src/substack.rs

View file
@@ -7,7 +7,7 @@ use giterated_models::{
7 7 object::{GiteratedObject, ObjectRequest, ObjectResponse},
8 8 operation::GiteratedOperation,
9 9 settings::Setting,
10 value::{GetValueTyped, GiteratedObjectValue},
10 value::GiteratedObjectValue,
11 11 };
12 12 use tracing::{info, trace};
13 13
@@ -219,17 +219,12 @@ impl<S: Send + Sync + Clone + 'static> SubstackBuilder<S> {
219 219 /// # Type Registration
220 220 /// This will register the provided [`GiteratedObjectValue`] type for its matching / specified
221 221 /// object type. It will **not** register the object type automatically.
222 pub fn value<O, V, A, F, E, Fut>(&mut self, handler: F) -> &mut Self
222 pub fn value<O, V, A, F, E>(&mut self, handler: F) -> &mut Self
223 223 where
224 224 O: GiteratedObject + 'static,
225 225 V: GiteratedObjectValue<Object = O> + 'static + Clone,
226 F: IntoGiteratedHandler<
227 (O, GetValueTyped<V>),
228 A,
229 S,
230 StackOperationState,
231 Result<V, OperationError<E>>,
232 > + Send
226 F: IntoGiteratedHandler<(O,), A, S, StackOperationState, Result<V, OperationError<E>>>
227 + Send
233 228 + Sync,
234 229 E: Into<anyhow::Error> + 'static + std::fmt::Debug + Clone,
235 230 F: 'static,
@@ -238,16 +233,11 @@ impl<S: Send + Sync + Clone + 'static> SubstackBuilder<S> {
238 233
239 234 let wrapped = wrapped.map(
240 235 |(any_object,): &(AnyObject,), _state: &StackOperationState| {
241 Ok((
242 any_object
243 .0
244 .downcast_ref::<O>()
245 .ok_or_else(|| OperationError::Internal(DowncastError.into()))?
246 .clone(),
247 GetValueTyped {
248 ty: std::marker::PhantomData,
249 },
250 ))
236 Ok((any_object
237 .0
238 .downcast_ref::<O>()
239 .ok_or_else(|| OperationError::Internal(DowncastError.into()))?
240 .clone(),))
251 241 },
252 242 );
253 243