Skip to content

fix(notifications): truncate X post attachment titles in notification list#5867

Merged
AmarTrebinjac merged 3 commits intomainfrom
eng-1258-truncate-x-notifications
Apr 15, 2026
Merged

fix(notifications): truncate X post attachment titles in notification list#5867
AmarTrebinjac merged 3 commits intomainfrom
eng-1258-truncate-x-notifications

Conversation

@AmarTrebinjac
Copy link
Copy Markdown
Contributor

@AmarTrebinjac AmarTrebinjac commented Apr 15, 2026

Summary

  • Apply CSS line-clamp-3 truncation to notification attachment titles for SourcePostAdded, UserPostAdded, and SquadPostAdded notification types
  • Thread notificationType prop from NotificationItem down to NotificationItemAttachment to enable conditional styling
  • Uses the existing multi-truncate line-clamp-3 pattern already established in InAppNotificationItem and social card components

Key decisions

  • Scoped by notification type, not post type: The notification attachment model doesn't carry PostType, so we scope by the three notification types that can produce X post attachments. For non-X posts under these types, article titles are naturally short and won't hit the 3-line clamp.
  • CSS-only approach: Retroactively fixes all existing notifications. Full text preserved in DOM for accessibility. No backend/schema changes needed.
  • line-clamp-3: Matches the existing InAppNotificationItem pattern (~3 visible lines).

Test plan

  • All 14 existing NotificationItem.spec.tsx tests pass
  • Manual QA: verify X post notification attachments truncate to ~3 lines with ellipsis
  • Manual QA: verify other notification type attachments are unaffected

Closes ENG-1258


Created by Huginn 🐦‍⬛

Preview domain

https://eng-1258-truncate-x-notification.preview.app.daily.dev

… list

Apply CSS line-clamp-3 to notification attachment titles for
SourcePostAdded, UserPostAdded, and SquadPostAdded notification types.
This prevents X post content from stretching the /notifications page
vertically while preserving full text in the DOM for accessibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
daily-webapp Ready Ready Preview Apr 15, 2026 0:57am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
storybook Ignored Ignored Apr 15, 2026 0:57am

Request Review

@AmarTrebinjac
Copy link
Copy Markdown
Contributor Author

@claude fix build errors

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 15, 2026

Claude finished @AmarTrebinjac's task in 15m 57s —— View job


Fixed build errors

  • Gather context and read changed files
  • Identify build errors — typecheck_strict_changed CI step catches 8 strict TS errors in NotificationItem.tsx because the file was touched by this PR
  • Fix strict TypeScript errors in NotificationItem.tsx
  • Verify type check passes (Changed TypeScript files passed strict migration guard.)
  • All 14 NotificationItem.spec.tsx tests still pass
  • Commit and push fixes

What was fixed

The typecheck_strict_changed CI job runs strict TypeScript on every file changed by the PR. Since NotificationItem.tsx was touched, 8 pre-existing strict-mode violations were surfaced:

Line Error Fix
93 Icon() return type was ReactElement but returned null Changed to ReactElement | null
110–112 label returned null but was typed as string Return '' instead (required by MenuItemProps.label: string)
121–123 notificationMutingCopy[type] is ActionCopy | undefined (Partial record), copy accessed without guard Added if (!copy) return ''; guard
148 NotificationItem return type was ReactElement but returned null when !isReady Changed to ReactElement | null
168 description is string | undefined, but useObjectPurify requires Record<string, string | Node> Used description ?? '' — this also resolved the downstream string | Node not assignable to string | TrustedHTML errors on lines 263 & 272
Branch

Fix 8 strict-mode TS errors exposed by typecheck_strict_changed CI step
because the file was touched by this PR:

- Icon(): change return type to ReactElement | null
- label: return '' instead of null when notification is missing or copy
  is undefined (notificationMutingCopy is Partial, so lookup can return
  undefined)
- NotificationItem: change return type to ReactElement | null
- useObjectPurify call: use `description ?? ''` so the input object
  satisfies Record<string, string | Node> (no undefined values)

Co-authored-by: Amar Trebinjac <AmarTrebinjac@users.noreply.github.com>
@AmarTrebinjac AmarTrebinjac merged commit 6e8a461 into main Apr 15, 2026
12 checks passed
@AmarTrebinjac AmarTrebinjac deleted the eng-1258-truncate-x-notifications branch April 15, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant