-
-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Feature Summary
Activity titles are incorrectly truncated at the first period, causing issues with titles containing name prefixes (Mrs., Mr., etc.).
Problem Statement
The current implementation splits activity titles at the first period encountered, which causes unintended truncation when the activity contains common name prefixes like Mrs., Mr., Dr., etc. This results in incomplete and incorrect activity summaries in the UI.
Proposed Solution
Modify the title extraction logic to:
- Recognize common name prefixes and prevent splitting on their periods
- Implement a more robust first-line extraction that maintains the integrity of titles containing periods
- Update the existing regex to handle these edge cases properly
Current code:
const title = useMemo(() => message.split('\n')[0].replace(/:$/, ''), [message]).trim();User Benefits
- Users will see complete and accurate activity titles
- Proper handling of formal names and titles in activities
- Improved readability and professionalism in the activity feed
- Reduced confusion from truncated titles
Primary User Type
End User
Business Priority
Medium - Nice to have improvement
Technical Requirements
- Create a list of common name prefixes to exclude from splitting
- Ensure backwards compatibility with existing activity data
- Maintain performance of title extraction
- Handle edge cases like multiple prefixes or periods
- Consider internationalization implications
Acceptance Criteria
- Activity titles containing "Mr." remain intact
- Activity titles containing "Mrs." remain intact
- Activity titles containing "Dr." remain intact
- Activity titles containing other common prefixes remain intact
- Original functionality for legitimate sentence splits remains working
- Unit tests cover prefix edge cases
- Performance impact is negligible
Use Cases / Scenarios
- User creates activity with title "Mrs. Smith reviewed the document"
- Expected: Full title shows
- Current: Only "Mrs" shows
- User creates activity with title "Mr. Jones and Dr. Smith collaborated"
- Expected: Full title shows
- Current: Only "Mr" shows
- User creates activity with multiple sentences
- Expected: Only first sentence shows
- Current: Working correctly for this case
Mockups / Examples
// Example test cases:
"Mrs. Smith reviewed the document" -> "Mrs. Smith reviewed the document"
"Mr. Jones sent the email" -> "Mr. Jones sent the email"
"Dr. Brown completed the review. Additional notes added." -> "Dr. Brown completed the review"Additional Context
The issue appears to be in the title extraction logic that doesn't account for common name prefixes. The current implementation uses a simple string split that doesn't consider these edge cases. Similar issues have been reported in other text processing systems, and common solutions involve prefix lookups or more sophisticated regex patterns.