Skip to content

add [tasks] - push notifications when assigned a task#769

Merged
danielkweon merged 20 commits intomainfrom
daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notifications
Dec 31, 2025
Merged

add [tasks] - push notifications when assigned a task#769
danielkweon merged 20 commits intomainfrom
daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notifications

Conversation

@danielkweon
Copy link
Copy Markdown
Contributor

add [tasks] - add notifications when assigned a task

@danielkweon danielkweon self-assigned this Dec 30, 2025
@danielkweon danielkweon requested review from a team as code owners December 30, 2025 17:37
@linear
Copy link
Copy Markdown

linear bot commented Dec 30, 2025

@danielkweon danielkweon changed the base branch from main to daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notification-permissions December 30, 2025 17:37
Base automatically changed from daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notification-permissions to main December 30, 2025 20:56
@danielkweon danielkweon force-pushed the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notifications branch from 02ecbf3 to c49048d Compare December 30, 2025 21:14
- Add grant_entity_permissions method to PermissionService trait
- Implement grant_entity_permissions in PermissionServiceImpl using upsert_user_item_access_bulk
- Update handle_task_assignee_permissions to grant edit permissions to assignees
- Add macro_db_client dependency to properties crate
- Tasks are granted edit permissions when assignees are updated
- Add TaskAssigned variant to NotificationEvent enum
- Add TaskAssignedMetadata struct with task_id, task_name, and assigned_by fields
- Update metadata_json and try_from_type_and_meta methods to handle TaskAssigned
- Add impl_notification_metadata macro for TaskAssignedMetadata
- Add NotificationService trait to domain ports
- Defines send_notification method for sending notification messages
- Includes mockall support for testing
- Add NotificationServiceImpl using MacroNotifyClient
- Implement NotificationService trait with send_notification method
- Add macro_notify and model_notifications dependencies
- Export NotificationService and NotificationServiceImpl from lib.rs
- Add notification_service module to outbound
…eImpl

- Add NotificationService generic parameter N to PropertiesServiceImpl
- Add optional notification_service field to PropertiesServiceImpl
- Update constructor to accept optional NotificationService
- Update task_properties impl to include NotificationService generic
- NotificationService is optional, allowing None for tests or when not needed
…nd document_storage_service

- Initialize MacroNotifyClient in properties_service main.rs
- Create NotificationServiceImpl and pass to PropertiesServiceImpl
- Update PropertiesService type signature in properties_service context.rs
- Add macro_notify dependency to properties_service Cargo.toml
- Update document_storage_service to use NotificationService
- Both services now pass NotificationServiceImpl to PropertiesServiceImpl
- Add MockNotificationService parameter to PropertiesServiceImpl::new calls
- Tests now pass None::<MockNotificationService> for notification service
- Maintains test compatibility with optional NotificationService
… entities

Both Task and Document entities are stored in the Document table
(tasks are documents with sub_type='task'), so they use the same
query logic. Updated the implementation to handle both entity types
in a single match arm.
- Send notifications to new assignees only (filters out existing assignees)
- Filter out the assigner from notification recipients
- Send notifications in parallel using futures::future::join_all
- Grant edit permissions to all assignees (new and existing)
- Get task name from repository for notification metadata
- Handle edge cases: empty assignees, missing services, invalid user IDs
…ssions

- Test permission granting for all assignees
- Test notification sending to new assignees only
- Test filtering out assigner from notifications
- Test edge cases: empty assignees, no service, no new assignees
- Test integration: both handlers called correctly
- Test clearing assignees (None value)
…sions_to_task

Make the method task-specific by:
- Renaming to grant_permissions_to_task for clarity
- Removing entity_type parameter (always Task)
- Renaming entity_id parameter to task_id
- Simplifying implementation (no entity_type matching needed)
@danielkweon danielkweon force-pushed the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notifications branch from c49048d to 78db6fb Compare December 30, 2025 21:16
Copy link
Copy Markdown
Contributor

@synoet synoet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly Fine. Left a bunch of nits. Fix at your convenience.

const hasTaskName = m.taskName != null && m.taskName.trim() !== '';
return {
type: n.notificationEventType,
actor: m.assignedBy ? { id: m.assignedBy } : undefined,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is something wrong with type gen ? Shouldn't this always be defined ?

Copy link
Copy Markdown
Contributor Author

@danielkweon danielkweon Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other notifications also have undefined actors. i fixed up target to never be undefined

@danielkweon danielkweon force-pushed the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notifications branch from 86ef7fd to 192460d Compare December 31, 2025 02:37
@danielkweon danielkweon merged commit c400f2a into main Dec 31, 2025
37 checks passed
@danielkweon danielkweon deleted the daniel/m-5426--add-tasks-quick-create-menu-hexagon-migration-notifications branch December 31, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants