From b4fe9c145b8857f4085e118ecce918701eb2878b Mon Sep 17 00:00:00 2001 From: Strycher Date: Mon, 20 Jul 2026 01:01:18 -0400 Subject: [PATCH] fix(#283): summarise the same GIF set the chat renders formatNotificationText used GifHelper.parseGif (Giphy only) while the chat renders via resolveGifUrl (Giphy + allowlisted Tenor CDN). An allowlisted Tenor GIF therefore rendered inline but still dumped a raw URL into the notification tray. Point both at resolveGifUrl so the tray summarises exactly the set the chat displays. Off-allowlist URLs still pass through as plain text, pinned by test. This is the same duplicate-detection drift that caused #284; closing it at the source rather than shipping a known inconsistency. Co-Authored-By: Claude Opus 4.8 --- lib/services/notification_service.dart | 4 +++- test/services/notification_text_test.dart | 29 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index d526b81..f08d88a 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -155,7 +155,9 @@ class NotificationService { if (reaction != null) { return 'Reacted ${reaction.emoji}'; } - if (GifHelper.parseGif(trimmed) != null) { + // resolveGifUrl, not parseGif: the tray must summarise exactly the set the + // chat renders inline, or an allowlisted Tenor GIF shows as a raw URL. (#283) + if (GifHelper.resolveGifUrl(trimmed) != null) { return 'Sent a GIF'; } return text; diff --git a/test/services/notification_text_test.dart b/test/services/notification_text_test.dart index 8875798..3da21ad 100644 --- a/test/services/notification_text_test.dart +++ b/test/services/notification_text_test.dart @@ -64,4 +64,33 @@ void main() { ); }); }); + + group('allowlisted media URLs summarise too (#283 consistency)', () { + test('a pasted i.giphy.com link summarises', () { + expect( + NotificationService.formatNotificationText( + 'https://i.giphy.com/$gifId.webp', + ), + 'Sent a GIF', + ); + }); + + test('a pasted Tenor CDN link summarises', () { + expect( + NotificationService.formatNotificationText( + 'https://media.tenor.com/abc123XYZ/happy-dance.gif', + ), + 'Sent a GIF', + ); + }); + + test('an off-allowlist image URL does NOT summarise', () { + expect( + NotificationService.formatNotificationText( + 'https://evil.example.com/tracker.gif', + ), + 'https://evil.example.com/tracker.gif', + ); + }); + }); }