mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-08 19:06:38 +03:00
send new sessions on fetch
This commit is contained in:
parent
0b977613b1
commit
9eaef82393
@ -23,6 +23,11 @@ impl<'listener> Handler<'listener> {
|
||||
}
|
||||
|
||||
pub fn handle(&self, project: &projects::Project) -> Result<Vec<events::Event>> {
|
||||
let sessions_before_fetch = self
|
||||
.gb_repository
|
||||
.get_sessions_iterator()?
|
||||
.filter_map(|s| s.ok())
|
||||
.collect::<Vec<_>>();
|
||||
if !self.gb_repository.fetch().context("failed to fetch")? {
|
||||
return Ok(vec![]);
|
||||
}
|
||||
@ -41,6 +46,24 @@ impl<'listener> Handler<'listener> {
|
||||
..Default::default()
|
||||
})
|
||||
.context("failed to update project")?;
|
||||
Ok(vec![])
|
||||
|
||||
let sessions_after_fetch = self
|
||||
.gb_repository
|
||||
.get_sessions_iterator()?
|
||||
.filter_map(|s| s.ok())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let new_sessions = sessions_after_fetch
|
||||
.iter()
|
||||
.filter(|s| !sessions_before_fetch.contains(s))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let events = new_sessions
|
||||
.into_iter()
|
||||
.cloned()
|
||||
.map(|session| events::Event::Session((project.clone(), session)))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Ok(events)
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@
|
||||
const description = formData.get('description') as string | undefined;
|
||||
|
||||
try {
|
||||
if (name) {
|
||||
if ($project.api && name) {
|
||||
const updated = await cloud.projects.update(
|
||||
$user.access_token,
|
||||
$project.api.repository_id,
|
||||
|
Loading…
Reference in New Issue
Block a user