Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(tasks): share new tasks with the team at edit access (#7073)
teo765b84a05882
diff --git a/crates/documents/src/domain/models.rs b/crates/documents/src/domain/models.rsindex 070e01e574..1a0d3c62a3 100644--- a/crates/documents/src/domain/models.rs+++ b/crates/documents/src/domain/models.rs@@ -333,7 +333,7 @@ pub struct CreateDocumentRepoArgs {pub project_id: Option<uuid::Uuid>,/// Team to use when assigning a per-team task number, never sharing authority.pub team_id: Option<uuid::Uuid>,- /// Explicit task creation consent. Initializes Comment using the persisted owner's team.+ /// Explicit task creation consent. Initializes Edit using the persisted owner's team./// Ordinary documents, snippets, and imports must leave this false.pub share_with_team: bool,/// Custom creation timestamp.diff --git a/crates/documents/src/outbound/pg_document_repo/tests.rs b/crates/documents/src/outbound/pg_document_repo/tests.rsindex 542f4937c3..10981a58a1 100644--- a/crates/documents/src/outbound/pg_document_repo/tests.rs+++ b/crates/documents/src/outbound/pg_document_repo/tests.rs@@ -341,7 +341,7 @@ async fn creation_team_consent_is_explicit_and_uses_owner_membership(pool: Pool<.unwrap();let grant = facts.current.unwrap();assert_eq!(grant.team_id, TEST_TEAM_ID);- assert_eq!(grant.level, TeamShareLevel::Comment);+ assert_eq!(grant.level, TeamShareLevel::Edit);assert_eq!(facts.revision, 1);assert_eq!(repo.get_team_task_metadata(&document.document_id)@@ -359,7 +359,7 @@ async fn creation_team_consent_is_explicit_and_uses_owner_membership(pool: Pool<.fetch_one(&pool).await.unwrap();- assert_eq!(level, AccessLevel::Comment);+ assert_eq!(level, AccessLevel::Edit);}#[sqlx::test(diff --git a/crates/models_permissions/src/share_permission/team_share.rs b/crates/models_permissions/src/share_permission/team_share.rsindex 692f30d9c2..f58daf9ccc 100644--- a/crates/models_permissions/src/share_permission/team_share.rs+++ b/crates/models_permissions/src/share_permission/team_share.rs@@ -211,7 +211,7 @@ pub enum TeamShareCreation {/// Ordinary creation and copies initialize NULL explicit sharing.#[default]Unshared,- /// An explicitly shared task initializes Comment; missing membership is an error.+ /// An explicitly shared task initializes Edit; missing membership is an error.ExplicitTask,/// A new call initializes View only if its creator currently belongs to a team.Call,@@ -231,7 +231,7 @@ impl TeamShareCreation {Self::Unshared => Ok(None),Self::ExplicitTask => Ok(Some(TeamShareGrant {team_id: owner_team_id.ok_or(TeamSharePolicyError::MissingTeam)?,- level: TeamShareLevel::Comment,+ level: TeamShareLevel::Edit,})),Self::Call => Ok(owner_team_id.map(|team_id| TeamShareGrant {team_id,diff --git a/crates/models_permissions/src/share_permission/team_share/test.rs b/crates/models_permissions/src/share_permission/team_share/test.rsindex a465ccd4d9..6d0c802007 100644--- a/crates/models_permissions/src/share_permission/team_share/test.rs+++ b/crates/models_permissions/src/share_permission/team_share/test.rs@@ -311,7 +311,7 @@ fn creation_contract_distinguishes_ordinary_task_call_and_initiative_defaults()TeamShareCreation::ExplicitTask.resolve(Some(team_id)),Ok(Some(TeamShareGrant {team_id,- level: TeamShareLevel::Comment,+ level: TeamShareLevel::Edit,})));assert_eq!(TeamShareCreation::Initiative.resolve(None), Ok(None));diff --git a/crates/share_permission_db_utils/src/team_share/test.rs b/crates/share_permission_db_utils/src/team_share/test.rsindex 95cebbd728..4cf3aff65d 100644--- a/crates/share_permission_db_utils/src/team_share/test.rs+++ b/crates/share_permission_db_utils/src/team_share/test.rs@@ -279,9 +279,7 @@ async fn initialize_call_grants_view_to_creator_team_or_nothing(migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "../../fixtures", scripts("team_share")))]-async fn initialize_grants_comment_to_owner_team_for_initiative(- pool: PgPool,-) -> rootcause::Result<()> {+async fn initialize_explicit_task_grants_edit_to_owner_team(pool: PgPool) -> rootcause::Result<()> {let entity = initiative();let uuid = Uuid::parse_str(&entity.entity_id)?;let mut tx = pool.begin().await?;@@ -300,13 +298,13 @@ async fn initialize_grants_comment_to_owner_team_for_initiative(facts.current,Some(TeamShareGrant {team_id,- level: TeamShareLevel::Comment,+ level: TeamShareLevel::Edit,}));assert_eq!(facts.revision, 1);assert_eq!(direct_team_rows(&mut tx, &uuid, EntityType::Initiative, team_id).await?,- vec![AccessLevel::Comment]+ vec![AccessLevel::Edit]);Ok(())}diff --git a/tooling/seed_cli/src/entity/scenario/apply.rs b/tooling/seed_cli/src/entity/scenario/apply.rsindex 8624b20710..dcc861a1ba 100644--- a/tooling/seed_cli/src/entity/scenario/apply.rs+++ b/tooling/seed_cli/src/entity/scenario/apply.rs@@ -746,11 +746,11 @@ async fn seed_tasks(ctx: &SeedCliContext, spec: &ScenarioSpec) -> anyhow::Result&& let Some(team) = spec.team_of(&task.owner){// Mirrors the app's share-with-team toggle on tasks: the owner's- // team gets comment access.+ // team gets edit access.rows.push(AccessRow {source_id: spec.team_id(team).to_string(),source_type: EntityAccessSourceType::Team,- access_level: AccessLevel::Comment,+ access_level: AccessLevel::Edit,granted_from_project_id: None,});}diff --git a/tooling/seed_cli/src/entity/scenario/matrix.rs b/tooling/seed_cli/src/entity/scenario/matrix.rsindex 9a66b23a78..ae910a8639 100644--- a/tooling/seed_cli/src/entity/scenario/matrix.rs+++ b/tooling/seed_cli/src/entity/scenario/matrix.rs@@ -183,7 +183,7 @@ pub fn expected_matrix(spec: &ScenarioSpec) -> Vec<ExpectedRow> {access_rows.push(apply::AccessRow {source_id: spec.team_id(team).to_string(),source_type: entity_access_db_utils::EntityAccessSourceType::Team,- access_level: AccessLevel::Comment,+ access_level: AccessLevel::Edit,granted_from_project_id: None,});}diff --git a/tooling/seed_cli/src/entity/scenario/matrix/test.rs b/tooling/seed_cli/src/entity/scenario/matrix/test.rsindex a0275d248a..a24f216557 100644--- a/tooling/seed_cli/src/entity/scenario/matrix/test.rs+++ b/tooling/seed_cli/src/entity/scenario/matrix/test.rs@@ -247,8 +247,8 @@ fn task_expectations_cover_team_share_and_inheritance() {let spec = example();let rows = expected_matrix(&spec);- // ship-tags: alice owns it; the team gets comment via share_with_team;- // the project's team view is subsumed by comment; dave/eve see nothing.+ // ship-tags: alice owns it; the team gets edit via share_with_team;+ // the project's team view is subsumed by edit; dave/eve see nothing.// erin is an assignee, but her edit comes from the direct share, not the// assignment.assert_eq!(@@ -257,15 +257,15 @@ fn task_expectations_cover_team_share_and_inheritance() {);assert_eq!(level(&rows, "task:ship-tags", "bob"),- Some(AccessLevel::Comment)+ Some(AccessLevel::Edit));assert_eq!(level(&rows, "task:ship-tags", "carol"),- Some(AccessLevel::Comment)+ Some(AccessLevel::Edit));assert_eq!(level(&rows, "task:ship-tags", "dave"), None);assert_eq!(level(&rows, "task:ship-tags", "eve"), None);- // erin has a direct edit share, which wins over the team's comment.+ // erin has a direct edit share, which matches the team's edit.assert_eq!(level(&rows, "task:ship-tags", "erin"),Some(AccessLevel::Edit)@@ -291,7 +291,7 @@ fn task_expectations_cover_team_share_and_inheritance() {);assert_eq!(level(&rows, "task:write-docs", "carol"),- Some(AccessLevel::Comment)+ Some(AccessLevel::Edit));assert_eq!(level(&rows, "task:write-docs", "dave"), None);assert_eq!(diff --git a/tooling/seed_cli/src/entity/scenario/spec.rs b/tooling/seed_cli/src/entity/scenario/spec.rsindex e157a7f662..3171aa40e2 100644--- a/tooling/seed_cli/src/entity/scenario/spec.rs+++ b/tooling/seed_cli/src/entity/scenario/spec.rs@@ -278,7 +278,7 @@ pub struct TaskSpec {/// Assignee user keys. Defaults to the owner.#[serde(default)]pub assignees: Vec<String>,- /// Grant the owner's team comment access, like the app's+ /// Grant the owner's team edit access, like the app's/// share-with-team toggle on tasks.#[serde(default)]pub share_with_team: bool,