Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions collab/src/folder/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use uuid::Uuid;

use super::folder_observe::ViewChangeSender;
use super::hierarchy_builder::{FlattedViews, ParentChildViews};
use super::revision::RevisionMapping;
use super::section::{Section, SectionItem, SectionMap};
use super::{
FolderData, ParentChildRelations, SectionChangeSender, SpacePermission, TrashInfo, View,
Expand Down Expand Up @@ -57,7 +56,6 @@ const VIEWS: &str = "views";
const PARENT_CHILD_VIEW_RELATION: &str = "relation";
const CURRENT_VIEW: &str = "current_view";
const CURRENT_VIEW_FOR_USER: &str = "current_view_for_user";
const REVISION_MAP: &str = "revision_map";

pub(crate) const FAVORITES_V1: &str = "favorites";
const SECTION: &str = "section";
Expand Down Expand Up @@ -1098,11 +1096,6 @@ impl Folder {
}
}

pub fn replace_view(&mut self, from: &ViewId, to: &ViewId, uid: i64) -> bool {
let mut txn = self.collab.transact_mut();
self.body.replace_view(&mut txn, from, to, Some(uid))
}

/// Get a view by id. When uid is provided, includes user-specific data like is_favorite.
/// When uid is None, returns base view data without user-specific enrichment.
pub fn get_view(&self, view_id: &ViewId, uid: Option<i64>) -> Option<Arc<View>> {
Expand Down Expand Up @@ -1244,9 +1237,6 @@ impl FolderBody {
let parent_child_relations = Arc::new(ParentChildRelations::new(
root.get_or_init(&mut txn, PARENT_CHILD_VIEW_RELATION),
));
let revision_map = Arc::new(RevisionMapping::new(
root.get_or_init(&mut txn, REVISION_MAP),
));

let section = Arc::new(SectionMap::create(
&mut txn,
Expand All @@ -1262,7 +1252,6 @@ impl FolderBody {
.map(|notifier| notifier.view_change_tx.clone()),
parent_child_relations,
section.clone(),
revision_map,
));

if let Some(folder_data) = folder_data {
Expand Down Expand Up @@ -1612,18 +1601,6 @@ impl FolderBody {
current_view_for_user.try_update(txn, uid.to_string(), view.to_string());
}
}

pub fn replace_view(
&self,
txn: &mut TransactionMut,
old_view_id: &ViewId,
new_view_id: &ViewId,
uid: Option<i64>,
) -> bool {
uid
.map(|uid| self.views.replace_view(txn, old_view_id, new_view_id, uid))
.unwrap_or(false)
}
}

pub fn default_folder_data(uid: i64, workspace_id: &str) -> FolderData {
Expand Down
30 changes: 8 additions & 22 deletions collab/src/folder/folder_observe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::preclude::{
};
use tokio::sync::broadcast;

use super::revision::RevisionMapping;
use super::section::SectionMap;
use super::view::FOLDER_VIEW_ID;
use super::{ParentChildRelations, View, ViewId, view_from_map_ref};
Expand All @@ -27,7 +26,6 @@ pub(crate) fn subscribe_view_change(
change_tx: ViewChangeSender,
view_relations: Arc<ParentChildRelations>,
section_map: Arc<SectionMap>,
revision_mapping: Arc<RevisionMapping>,
uid: i64,
) -> Subscription {
let r = root.clone();
Expand All @@ -45,16 +43,10 @@ pub(crate) fn subscribe_view_change(
if let Some(view_id_str) = map_ref.get_with_txn::<_, String>(txn, FOLDER_VIEW_ID)
{
if let Ok(view_uuid) = uuid::Uuid::parse_str(&view_id_str) {
let (view_id, mappings) = revision_mapping.mappings(txn, view_uuid);
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_id.to_string()) {
if let Some(view) = view_from_map_ref(
&map_ref,
txn,
&view_relations,
&section_map,
Some(uid),
mappings,
) {
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_uuid.to_string()) {
if let Some(view) =
view_from_map_ref(&map_ref, txn, &view_relations, &section_map, Some(uid))
{
deletion_cache.insert(view.id, Arc::new(view.clone()));

// Send indexing view
Expand All @@ -71,16 +63,10 @@ pub(crate) fn subscribe_view_change(
.get_with_txn::<_, String>(txn, FOLDER_VIEW_ID)
{
if let Ok(view_uuid) = uuid::Uuid::parse_str(&view_id_str) {
let (view_id, mappings) = revision_mapping.mappings(txn, view_uuid);
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_id.to_string()) {
if let Some(view) = view_from_map_ref(
&map_ref,
txn,
&view_relations,
&section_map,
Some(uid),
mappings,
) {
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_uuid.to_string()) {
if let Some(view) =
view_from_map_ref(&map_ref, txn, &view_relations, &section_map, Some(uid))
{
// Update deletion cache with the updated view
deletion_cache.insert(view.id, Arc::new(view.clone()));
let _ = change_tx.send(ViewChange::DidUpdate { view });
Expand Down
1 change: 0 additions & 1 deletion collab/src/folder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ mod folder_migration;
mod folder_observe;
pub mod hierarchy_builder;
mod relation;
mod revision;
mod section;
pub mod space_info;
mod view;
Expand Down
79 changes: 0 additions & 79 deletions collab/src/folder/revision.rs

This file was deleted.

Loading
Loading